https://raw.github.com/tuupola/jquery_lazyload/master/jquery.lazyload.js
比較有趣的地方
- 觸發 settings.event 事件時,把所有 elements 走訪過並讀取應該要顯示的圖片後,利用 $.grep 濾出未顯示的圖片 elements,讓下次事件觸發時不必走訪已顯示的圖片。這邊是 Memoization pattern。
- 最下面 $.extend($.expr[‘:’], {} … 的部份,是說我們可以自定一些 pseudo class selector。
Though it may not be clear from the example, the || operator returns the value of the first truthy operand, or, in cases where neither operand is truthy, it’ll return the last of both operands. The && operator returns the value of the first false operand, or the value of the last operand if both operands are truthy.
jQuery Fundamentals