2014-12-11, 17:02
Tutorial: "Load more topics" query |
With this tutorial you can quickly load another page of posts without page refresh or clicking on the page number.
Provided by @Daemon
--> Tutorials, tips and tricks <--
"Load more topics" query
"Load more topics" query
1º - Javascript
Placement: In Subforums
- Code:
[panda=js] jQuery(function() {
if(jQuery('a[onmousedown^="createPagination"]').length != -1) {
jQuery('head').append(
'<style type="text/css">' +
' #more_topics_bestSK {' +
' text-align: center;' +
' font-weight: bold;' +
' }' +
' #more_topics_bestSK a {' +
' display: block;' +
' padding: 10px 0;' +
' }' +
' #content_loaded {' +
' border-top: 2px solid #ddd;' +
' }' +
'</style>'
);
jQuery('.statused:last').parent().after(
' <div id="more_topics_bestSK">' +
' <a href="#" id="load_more">Load more topics</a>' +
' </div>'
);
jQuery('.paging:first > b').next().addClass('load');
jQuery('#load_more').click(function() {
jQuery.get(jQuery('.load').attr('href'), function(d) {
var _loaded = jQuery('.statused:last', d).html();
if(_loaded && jQuery('.load').length) {
jQuery('<tbody id="content_loaded" class="statused">' + _loaded + '</tbody>').insertAfter('.statused:last');
jQuery('.load').removeClass('load').next('a:not(:has(img))').addClass('load');
} else {
alert("No more topics to be loaded");
}
});return false;
});
}
});
2º - Preview
© PunBB Design
If you have any questions related to this topic create a topic with the following title: "Load more topics" query |