开发者

Error message: "$(window).width is not a function"

i am trying to use a jQuery scrollbar called "Jscrollhorizontalpane". wh开发者_C百科en i am trying to use it i get the following error message: "$(window).width is not a function" in firebug's console.

i am new to jQuery do this might be very basic but still, i dont know what that means and why there is a problem.

the scroller comes in a bundle with a few files, one of which is called "jScrollHorizontalPane.js" and i believe it holds the code for the scroller. i tried replacing $ signs there with the word "jQuery" (in case there is a conflict) but it didnt seem to help.

also important to add that on the same page i am using another jQuery scroller (a vertical one as opposed to the horizontal on mentioned above) which works just fine. the code for this one doesnt use $(window).width but uses $(window) many times...

any ideas?


It sounds like you have a conflict somewhere.

I would suggest finding the route of the problem first;

  • Make sure you are including jquery.js above jScrollHorizontalPane.js in your html
  • Remove the other javascript files (other than jquery) temporarily and see if that fixes it
  • Try using different versions of jQuery, you can load them straight off google's CDN and just change the version number http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js

If none of those work then update your question with a live demo link.


does changing $(window).width to $(window).width() solve your problem ?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜