开发者

jQuery function not moving... can't find anything wrong with it?

I'm trying to take these moving clouds: http://vintageskytheme.tumblr.com/ (it's a theme I've already bought from themeforest, but its for tumblr)

I'm trying to put it on wordpress. here: http://pawprintsinmypancakes.com/

it used to be $() function and i see it giving errors in console every 30 milliseconds so i know the rest of the code IS working... but when i change it to jQuery()... console is just silent. I ha开发者_运维百科ve no idea whats wrong


2 things:

1: Change the following code:

//Set the CSS of the header.
jQuery('#head_interior').css("background-position", current + " bottom");
jQuery('#head_exterior').css("background-position", current2 + " bottom");

to this:

//Set the CSS of the header.
jQuery('#head_interior').css("background-position", current + "px bottom");
jQuery('#head_exterior').css("background-position", current2 + "px bottom");

Note the "px" added before the "bottom". You need these when setting css styles, because css allows for px, em, pt, etc... If you don't tell it what unit to use, it'll happily ignore your values.

That will get your clouds moving.

2: Your $ object is getting overwritten. Not sure where. I would also suggest you wrap your code in a call to the jQuery object, like so:

jQuery(function(){
// your existing code here
});

That is the standard way of doing things with jQuery so you don't pollute the global scope.


Check this out: jQuery noConflict

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜