小编Liz*_*iza的帖子

无限滚动与woocommerce砌体不工作

我在将Wordpress中的无限滚动插件与使用砌体的主题集成时遇到了一个令人讨厌的问题.

我有无限滚动的最新版本2.6.2,我在插件的回调部分添加了这段代码:

// hide new items while they are loading
var $newElems = jQuery(newElements).css({ opacity: 0 });
// ensure that images load before adding to masonry layout
$newElems.imagesLoaded(function(){
// show elems now they're ready
$newElems.animate({ opacity: 1 });
    $container.masonry( 'appended', $newElems, true );
});
Run Code Online (Sandbox Code Playgroud)

但它不起作用,它增加了对新元素的不透明度,但它没有添加位置等,所以不太有效; 新产品将在旧产品的页面顶部显示.

脚本看起来像:

/* <![CDATA[ /
var infinite_scroll = "{\"loading\":{\"msgText\":\"Loading...<\\/em>\",\"finishedMsg\":\"No additional products.<\\/em>\",\"img\":\"http:\\/\\/www.test.com\\\/wp-content\\\/plugins\\\/infinite-scroll\\\/img\\\/ajax-loader.gif\"},\"nextSelector\":\".next\",\"navSelector\":\".woo-pagination\",\"itemSelector\":\"li.product\",\"contentSelector\":\"ul.products\",\"debug\":false,\"behavior\":\"\",\"callback\":\"\\\/\\\/ hide new items while they are loading\r\nvar $newElems = jQuery(newElements).css({ opacity: 0 });\r\n\\/\\/ ensure that images load before adding to masonry layout\r\n$newElems.imagesLoaded(function(){\r\n\\/\\/ show elems …
Run Code Online (Sandbox Code Playgroud)

javascript wordpress jquery jquery-masonry infinite-scroll

5
推荐指数
1
解决办法
2269
查看次数