Ich versuche, ein einfaches Tumblr-Thema mit dem flauschigen Plugin (https://github.com/mzdr/fluffy.js) zu machen, aber ich habe ein Problem festgestellt. Das Plugin wird nur einmal beim Laden der Seite ausgeführt. Ich versuche, es mit dem Infinite-Scroll-Plugin (http://www.infinite-scroll.com/) zu arbeiten, und ich brauche das flauschige Plugin, um auszulösen, wann immer neue Inhalte geladen werden.Auslösen von fluffy.js
Ich bin ziemlich neu, wenn es um JS geht, also schätze ich jede Hilfe, die ich bekommen kann. Vielen Dank.
bearbeiten hinzugefügt Code:
<script src="https://code.jquery.com/jquery-2.2.2.min.js"></script>
<script src="https://npmcdn.com/[email protected]/imagesloaded.pkgd.min.js"></script>
<script src="http://static.tumblr.com/hpghjri/co2nfnr1j/infinitescroll.min.js"></script>
<script src="http://static.tumblr.com/nxwjyyg/XWUob8gtq/fluffy.min.js"></script>
<script>
$(function(){
app.initInfinite();
app.onImagesLoad();
}); //end document ready
var app = {
'initInfinite' : function() {
var $container = $('.page-index .posts');
$container.infinitescroll({
navSelector:".pagination",
nextSelector:".pagination-next",
itemSelector:".posts__container",
appendCallback:true,
loading:{
finishedMsg:" ",
img:"data:image/gif;base64,R0lGODlhAQABAHAAACH5BAUAAAAALAAAAAABAAEAAAICRAEAOw==",
msg:null,
msgText:" ",
selector:null,
finished:function() {
}
}
},
function(newElements) {
var $newElems = $(newElements).css({opacity:0});
var $newElemsIDs = $newElems.map(function() {
return this.id;
Tumblr.LikeButton.get_status_by_post_ids($newElemsIDs);
}).get();
$newElems.imagesLoaded(function() {
$newElems.animate({opacity: 1});
//what to do when new elems appended
// I need to trigger fluffy here
});
var $newElemsIDs = $newElems.map(function() {
return this.id;
}).get();
Tumblr.LikeButton.get_status_by_post_ids($newElemsIDs);
});
},
'onImagesLoad' : function() {
$('.content .posts').imagesLoaded()
.always(function(instance) {
console.log('all images loaded');
$('.overlay').addClass('hide');
$('.overlay__preloader').attr('class', '');
})
.done(function(instance) {
console.log('all images successfully loaded');
});
}
}
</script>
Bitte posten Sie, was Sie bisher getan haben. (Code) – m02ph3u5
Es sieht nicht (für mich) aus, dass Fluffy eine dynamische Option hat. Du könntest kein Glück haben. – Ally