Javascript 在wordpress中将滚动循环添加到砌体图库
我正在尝试修改插件,以便在用户向下滚动到页面末尾时,无休止地重复它在图库中显示的图像。画廊位于 我对JavaScript的了解非常有限,但以下是我尝试过的: 在代码中,我找到了创建库的位置:Javascript 在wordpress中将滚动循环添加到砌体图库,javascript,jquery,wordpress,gallery,Javascript,Jquery,Wordpress,Gallery,我正在尝试修改插件,以便在用户向下滚动到页面末尾时,无休止地重复它在图库中显示的图像。画廊位于 我对JavaScript的了解非常有限,但以下是我尝试过的: 在代码中,我找到了创建库的位置: var initGallery = function() { $('.gallery-masonry').each( function() { var $container = $(this); var $posts = $container.children('.g
var initGallery = function() {
$('.gallery-masonry').each( function() {
var $container = $(this);
var $posts = $container.children('.gallery-item');
$posts.hide();
// keeps the media elements from calculating for the full width of the post
runMasonry(0, $container, $posts);
// we are going to append masonry items as the images load
$container.wcGalleryMasonryImagesReveal( $posts );
$(window).resize(function() {
runMasonry(0, $container, $posts);
});
});
在结束括号之前,我尝试在页面滚动到底部时重新运行initGallery,如下所示:
$(document).scroll(function(){
if (document.documentElement.clientHeight + $(window).scrollTop() >= $(document).height()) {
var $container = $(this);
var $posts = $container.children('.gallery-item');
$posts.hide();
// keeps the media elements from calculating for the full width of the post
runMasonry(0, $container, $posts);
// we are going to append masonry items as the images load
$container.wcGalleryMasonryImagesReveal( $posts );
$(window).resize(function() {
runMasonry(0, $container, $posts);
});
}
});
但它不起作用
有什么想法吗
提前谢谢大家