扩展更多jQuery


<script type="text/javascript">
function lastAddedLiveFunc(goto)  {
    alert(goto) ;
        jQuery('.scroll_container').scrollExtend(
            {   
                'target': 'div#scroll_items',           
                'url': 'components/com_a_main_search/more_content.php?limit='+goto, 
                'newElementClass': 'list_item more_content'
            }
        );
    }

$(window).scroll(function(){
    if  ($(window).scrollTop() == $(document).height() - $(window).height()){
     $('#limit').val( Number($('#limit').val()) + 2 );
       lastAddedLiveFunc($('#limit').val());
    }
}); 

toybly doeplans 0的价值???????虽然我把

alert(goto)

它显示正确的值将其始终放在此行中

'url': 'components/com_a_main_search/more_content.php?limit='+goto, 

请帮助

的机会是插件scrollExtend中有代码,以检测插件是否已经被初始化,并且如果有任何内容,则不执行任何操作。这意味着这些选项将与第一次初始化的选项保持不变,即使您尝试使用不同的选项再次初始化它。

没有看到插件的文档,很难提供进一步的帮助。查看插件初始化后是否支持更改选项

查看插件的来源,似乎一旦将选项称为元素,它也不会覆盖。一旦设置在元素上。

,但我注意到url参数可以是每当需要使用url时称为的函数。因此,您可以通过那里的功能,该功能将根据某些变量返回其他URL。

尝试

$(function(){
    var goto = 0;
    jQuery('.scroll_container').scrollExtend({   
        'target': 'div#scroll_items',           
        'url': function(){
            var current = goto;
            goto += 2;
            return 'components/com_a_main_search/more_content.php?limit='+current;
        }, 
        'newElementClass': 'list_item more_content'
    });
});

最新更新