-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathinc_print_infinitescroll.php
74 lines (64 loc) · 2.34 KB
/
inc_print_infinitescroll.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
if (isAlbumPage()) {
$containerClass = '.album-wrap';
$itemClass = '.album-thumb';
$viewMoreText = gettext_th('View more albums');
$noMoreText = gettext_th('No more albums to display');
} else if (isImagePage()) {
$containerClass = '.image-wrap';
$itemClass = '.image-thumb';
$viewMoreText = gettext_th('View more images');
$noMoreText = gettext_th('No more images to display');
}
?>
<?php if (hasNextPage()) { ?>
<div class="infinite-pagination">
<?php printNextPageURL(gettext('Next page'), NULL, 'infinite-next-page'); ?>
</div>
<div class="margin-bottom-double view-more">
<button class="btn btn-default center-block"><?php echo $viewMoreText; ?></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 $noMoreText; ?></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 = $('<?php echo $containerClass; ?>');
var $pageLoadStatus = $('.page-load-status');
var $viewMoreButton = $('.view-more');
$(document).ready( function() {
$container.infiniteScroll({
path : '.infinite-next-page',
append : '<?php echo $itemClass; ?>',
hideNav : '.infinite-pagination',
status : '.page-load-status',
loadOnScroll : false,
});
$container.on( 'append.infiniteScroll', function( event, response, path, newElements ) {
var $newElems = $(newElements).css({ opacity: 0 });
$newElems.imagesLoaded( function() {
$('.flag_thumbnail').removeAttr('style');
$newElems.animate({ opacity: 1 });
});
});
$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 } ?>