开发者

jquery and plugin order issue

I have used this header in my site:

<head>
  <script type="text/javascript" src="libs/jquery.js"></script>
  <script type="text/javascript" src="libs/jquery.jscrollpane.min.js"></script>
  <script type="text/javascript" src="libs/config.js"></script>
  <script type="text/javascript" src="libs/jquery.fancybox-1.3.4.js"></script>
  <script type="text/javascript" src="libs/jquery.easing-1.3.pack.js"></script>
  <script type="text/javascript" src="jwplayer/jwplayer.js"></script>
  <script type="text/javascript" src="libs/swfobject.js"></scrip开发者_开发技巧t>
</head>

for example, jscrollpane plugin loads after loading all images. There are so many images in site and creates very bad looking in internet explorer because plugin loads after images. The $(window).load() doesnot solve the problem. Is there any solution for this issue?

Thanks in advance

EDIT: images loads before js. There are many images in site and plugin'effect looks after image loading. And this is bad looking case.


This article might be of help - the basic idea is to hide your page from displaying anything until the content has been fully loaded and styled. If it's going to take very long, you might consider creating two main divs in your page - one for content and one for a spinner - and hide the content div and display the spinner so that users get feedback that the page is loadings and not broken.

You can hook into a callback method to re-display the page after everything is ready. Perhaps the $(window).load() event will be useful now or if the jQuery plugin you're using provides some callback indicating that it is ready, you might be better off using that.

Edit

jScrollPane has the jsp-initialised event that lets you know when an element has been initialized. Use that to identify when you should redisplay the page contents.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜