0

我已经在我的页面上设置了循环插件,并通过 ajax 将动态内容调用到页面中。然后我将此内容放入 div 中,然后运行插件。问题是它有时会在加载页面时完美运行,然后当我刷新页面时它根本不会加载。

有什么建议么?

    $.ajax({
  url: "http://www.site.co.uk/cgi-bin/latest-instructions-2.pl",
  success: function(html){
    $("#slider").html(html);
  }
});
$('#slider').cycle({ 
    fx: 'scrollLeft',
    cleartype: true,
        cleartypeNoBg: true,
        pager: '#li-number2',
        requeueOnImageNotLoaded: true  
});
4

1 回答 1

0

I managed to figure out what I was doing wrong, the slider was running before the page had loaded I simply added a window onload function as so...

$(window).bind("load", function() {
$('#slider').cycle({ 
    fx: 'scrollLeft',
    cleartype: true,
        cleartypeNoBg: true,
        pager: '#li-number2',
        requeueOnImageNotLoaded: true  
});
});
于 2011-09-13T14:59:24.017 回答