Make the infinite scroll plugin have a non-infinite scroll (button click to scroll) mode
This commit is contained in:
parent
74296fa12c
commit
cf8944526e
@ -40,7 +40,7 @@ class InfiniteScrollPlugin extends Plugin
|
|||||||
|
|
||||||
function onEndShowScripts($action)
|
function onEndShowScripts($action)
|
||||||
{
|
{
|
||||||
$action->script('plugins/InfiniteScroll/jquery.infinitescroll.min.js');
|
$action->script('plugins/InfiniteScroll/jquery.infinitescroll.js');
|
||||||
$action->script('plugins/InfiniteScroll/infinitescroll.js');
|
$action->script('plugins/InfiniteScroll/infinitescroll.js');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
jQuery(document).ready(function($){
|
jQuery(document).ready(function($){
|
||||||
$('notices_primary').infinitescroll({
|
$('notices_primary').infinitescroll({
|
||||||
debug: true,
|
debug: true,
|
||||||
|
infiniteScroll : false,
|
||||||
nextSelector : "li.nav_next a",
|
nextSelector : "li.nav_next a",
|
||||||
loadingImg : $('address .url')[0].href+'plugins/InfiniteScroll/ajax-loader.gif',
|
loadingImg : $('address .url')[0].href+'plugins/InfiniteScroll/ajax-loader.gif',
|
||||||
text : "<em>Loading the next set of posts...</em>",
|
text : "<em>Loading the next set of posts...</em>",
|
||||||
@ -12,4 +13,3 @@ jQuery(document).ready(function($){
|
|||||||
NoticeAttachments();
|
NoticeAttachments();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -92,14 +92,14 @@
|
|||||||
|
|
||||||
if (props.isDuringAjax || props.isInvalidPage || props.isDone) return;
|
if (props.isDuringAjax || props.isInvalidPage || props.isDone) return;
|
||||||
|
|
||||||
if ( !isNearBottom(opts,props) ) return;
|
if ( opts.infiniteScroll && !isNearBottom(opts,props) ) return;
|
||||||
|
|
||||||
// we dont want to fire the ajax multiple times
|
// we dont want to fire the ajax multiple times
|
||||||
props.isDuringAjax = true;
|
props.isDuringAjax = true;
|
||||||
|
|
||||||
// show the loading message and hide the previous/next links
|
// show the loading message and hide the previous/next links
|
||||||
props.loadingMsg.appendTo( opts.contentSelector ).show();
|
props.loadingMsg.appendTo( opts.contentSelector ).show();
|
||||||
$( opts.navSelector ).hide();
|
if(opts.infiniteScroll) $( opts.navSelector ).hide();
|
||||||
|
|
||||||
// increment the URL bit. e.g. /page/3/
|
// increment the URL bit. e.g. /page/3/
|
||||||
props.currPage++;
|
props.currPage++;
|
||||||
@ -205,10 +205,19 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// bind scroll handler to element (if its a local scroll) or window
|
if(opts.infiniteScroll){
|
||||||
$(opts.localMode ? this : window)
|
// bind scroll handler to element (if its a local scroll) or window
|
||||||
.bind('scroll.infscr', function(){ infscrSetup(path,opts,props,callback); } )
|
$(opts.localMode ? this : window)
|
||||||
.trigger('scroll.infscr'); // trigger the event, in case it's a short page
|
.bind('scroll.infscr', function(){ infscrSetup(path,opts,props,callback); } )
|
||||||
|
.trigger('scroll.infscr'); // trigger the event, in case it's a short page
|
||||||
|
}else{
|
||||||
|
$(opts.nextSelector).click(
|
||||||
|
function(){
|
||||||
|
infscrSetup(path,opts,props,callback);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@ -222,6 +231,7 @@
|
|||||||
$.infinitescroll = {
|
$.infinitescroll = {
|
||||||
defaults : {
|
defaults : {
|
||||||
debug : false,
|
debug : false,
|
||||||
|
infiniteScroll : true,
|
||||||
preload : false,
|
preload : false,
|
||||||
nextSelector : "div.navigation a:first",
|
nextSelector : "div.navigation a:first",
|
||||||
loadingImg : "http://www.infinite-scroll.com/loading.gif",
|
loadingImg : "http://www.infinite-scroll.com/loading.gif",
|
||||||
|
Loading…
Reference in New Issue
Block a user