我正在使用masinry和加載無限滾動jQuery插件的內容,並在這個內容中我有不同的FlexSlider幻燈片。當我使用無限滾動時,滑塊不能正確顯示,下一篇文章就位於同一位置,就像砌體不加載flexslider帖子一樣。 我認爲FlexSlider jQuery無法正常加載無限滾動。這是代碼:砌體,FlexSlider和無限滾動
FlexSlider:
<script>jQuery(document).ready(function ($) {
$(\'#' . $id . '\').flexslider({
namespace: "flex-",
selector: ".slides > li",
animation: "' . $animation_effect . '",
direction: "horizontal",
animationLoop: true,
slideshow: true,
slideshowSpeed:' . $slideshow_speed . ',
animationSpeed:' . $animation_speed . ',
pauseOnAction: true,
pauseOnHover: true,
useCSS: true,
touch: true,
video: true,
controlNav: false,
directionNav: false,
prevText: "",
nextText: "",
});});</script>
砌體+無限滾動:
<script>
jQuery(document).ready(function($){
var $container = $('#masonry-content');
$container.imagesLoaded(function(){
$container.masonry({
itemSelector: 'article',
columnWidth: 1,
});
});
<?php if($missiony_options['archives_infinite_scroll'] == 1) { ?>
$container.infinitescroll({
navSelector : '.archive-nav', // selector for the paged navigation
nextSelector : '.archive-nav .next', // selector for the NEXT link (to page 2)
itemSelector : '#masonry-content article', // selector for all items you'll retrieve
loading: {
finishedMsg: 'No more pages to load.',
img: 'http://i.imgur.com/6RMhx.gif',
msgText:'',
}
},
// trigger Masonry as a callback
function(newElements) {
// hide new items while they are loading
var $newElems = $(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);
$("a[rel^='prettyPhoto']").prettyPhoto();
$('#slider-74').flexslider();
});
});
<?php } ?>
});
</script>
的JavaScript是內嵌在網頁上,因爲我使用一些PHP變量。就像你可以看到的,我在加載infinete滾動,以及imageLoader和prettyPhoto之後,向砌體添加了新的元素。我試圖用FlexSlider做這樣的事情,但沒有。如何實現這一目標?請幫助!
dreanweaver不會顯示任何語法錯誤 – ThemesCreator