开发者

Delaying a Jquery function until Ajax is completely loaded

开发者 https://www.devze.com 2022-12-21 11:15 出处:网络
I am using a plugin that uses jquery to pull an rss feed, and displays it after the content loads. I wanted to use jScrollPane so I can have custom scrollbars.

I am using a plugin that uses jquery to pull an rss feed, and displays it after the content loads. I wanted to use jScrollPane so I can have custom scrollbars.

WithjScrollPane, it loads the scrollbars on pageload, but because the rssreader loads content with ajax, the scrollbars aren't applied (it takes 4 seconds to load the rss content, and by that time, the scrollbars have already tried loading. Because no content was there, they dont appear). I need to use jquery to tell jscrollpane not to load the scrollbars开发者_JAVA百科 until the rss is fully loaded. You can view the page here.

As you can see in the bottom left, the content is loaded, but doesn't display a scrollbar. I need a simple jquery command that says" do not run the jscrollpane commands until after the rss feed is fully loaded." Any ideas?


You need a callback function on the rss feed plugin and apply the scoll bars plugin in it. If the rss feed plugin does not allow you to specify a callback function, you'll need to edit the code to add one.


if there is not a callback available on the rssfeed plugin you can use setTimeout checking until div newsfeed got some content from rssfeed . Then call jScroll and stop the timer . not an elegant solution but works

0

精彩评论

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