0
<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());
    }
}); 

value of go to always 0 ?????? although i put

alert(goto)

it display right value put it always 0 in this line

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

Please help

2 Answers2

0

Chances are the plugin scrollExtend has code within it to detect if plugin has already been initialized and not to do anything if it has. This would mean the options would remain the same as the first time it gets initialized, even if you try to initialize it again with different options.

Without seeing the docs for your plugin, it will be hard to provide further help. Look to see if plugin supports changing options after being initialized

charlietfl
  • 170,828
  • 13
  • 121
  • 150
0

Looking at the source of the plugin, it seems that it will not overwrite the options once it has been called on an element.. And it also does not support a method to remove the plugin once set on an element.

But i noticed that the url parameter can be a function which is called whenever the url needs to be used. So you could pass a function there that will return a different url based on some variable..

Try

$(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'
    });
});
Gabriele Petrioli
  • 191,379
  • 34
  • 261
  • 317