1
我想實現這個grid,但是我不想使用Masonry插件,所以文章指出我需要刪除初始化,但是我不知道該怎麼做。如何從javaScript文件中刪除腳本初始化
的功能如下...
_init : function() {
this.items = Array.prototype.slice.call(document.querySelectorAll('#' + this.el.id + ' > div'));
this.itemsCount = this.items.length;
this.itemsRenderedCount = 0;
this.didScroll = false;
var self = this;
imagesLoaded(this.el, function() {
// initialize masonry
new Masonry(self.el, {
itemSelector: 'div',
transitionDuration : 0
});
if(Modernizr.cssanimations) {
// the items already shown...
self.items.forEach(function(el, i) {
if(inViewport(el)) {
self._checkTotalRendered();
classie.add(el, 'shown');
}
});
// animate on scroll the items inside the viewport
window.addEventListener('scroll', function() {
self._onScrollFn();
}, false);
window.addEventListener('resize', function() {
self._resizeHandler();
}, false);
}
});
},
我怎樣才能成功地刪除砌築腳本的初始化?
是的,我嘗試過,但是當我在頁面中調用實際的石匠腳本文件時,它會拋出一個錯誤,所以想檢查是否還有別的東西 – Adam
@Adam「it throws an error」<<可能想分享那個錯誤。 ;-) – nietonfir
對不起,它不會拋出錯誤,腳本不會運行。它似乎依賴於這個文件masonry.pkgd.min.js - https://github.com/codrops/GridLoadingEffects/tree/master/js – Adam