1
<script type="text/javascript">
$(function() {
$("ul#container img").lazyload({
event : "mouseover",
effect : "fadeIn"
});
var container = $("#container");
container.isotope({
itemSelector : 'ul#container > li',
layoutMode : 'masonry'
});
var ft = $.filtrify("container", "placeHolder", {
block : "data-original",
hide : false,
close : true,
callback : function (query, match, mismatch) {
/*
Extend jQuery with an "inview" selector to
select elements that are in the visible
part of the page (at least partiacialy)
*/
$.extend($.expr[':'],{
inview: function(el) {
var e = $(el),
w = $(window),
wt = w.scrollTop(),
wb = wt + w.height(),
et = e.offset().top,
eb = et + e.height();
return ((eb >= wt) && (et <= wb));
}
});
$("ul#container img").lazyload({
event : "scroll filter",
effect : "fadeIn"
});
$(match).find("img:inview").trigger("filter");
container.isotope({ filter : $(match) });
if (mismatch.length) $("div#reset").show();
else $("div#reset").hide();
}
});
$("div#reset span").click(function() {
ft.reset();
});
});
</script>
我們應用了一個過濾器後,出現的結果有主要的src圖像,放置數據的原始圖像,因爲它應該做與lazyload,雖然當我向下滾動到頁面,lazyload似乎工作正常,它只是自定義觸發事件「過濾器」,似乎不工作... –
感謝編輯它Tamas ... –