forked from vincent3569/zpBootstrap
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinc_print_infinitescroll_news.php
53 lines (45 loc) · 1.73 KB
/
inc_print_infinitescroll_news.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php if (zpB_hasNextNewsPage()) { ?>
<div class="infinite-pagination">
<?php zpB_printNextNewsPageURL(gettext('Next page'), 'infinite-next-page'); ?>
</div>
<div class="margin-top-double margin-bottom-double view-more">
<button class="btn btn-default center-block"><?php echo gettext_th('View more news'); ?></button>
</div>
<div class="page-load-status margin-top-double margin-bottom-double">
<div class="loader-ellips infinite-scroll-request">
<span class="loader-ellips-dot"></span>
<span class="loader-ellips-dot"></span>
<span class="loader-ellips-dot"></span>
<span class="loader-ellips-dot"></span>
</div>
<div class="infinite-scroll-last infinite-scroll-error"><?php echo gettext_th('No more news to display'); ?></div>
</div>
<script type="text/javascript" src="<?php echo $_zp_themeroot; ?>/js/infinite-scroll.pkgd.min.js"></script>
<script type="text/javascript">
//<![CDATA[
var $container = $('.news-wrap');
var $pageLoadStatus = $('.page-load-status');
var $viewMoreButton = $('.view-more');
$('.infinite-pagination a').addClass('infinite-next-page');
$(document).ready( function() {
$container.infiniteScroll({
path : '.infinite-next-page',
append : '.list-post',
hideNav : '.infinite-pagination',
status : '.page-load-status',
loadOnScroll : false,
});
$viewMoreButton.on( 'click', function() {
$container.infiniteScroll('loadNextPage');
$container.infiniteScroll('option', {
loadOnScroll : true,
});
$viewMoreButton.remove();
});
$container.on( 'last.infiniteScroll', function( event, response, path ) {
$pageLoadStatus.animate({ opacity: 0 }, 5000);
});
});
//]]>
</script>
<?php } ?>