nl_tokens: Load visible elements
pl_tokens: function checkLazyElements ( force ) { if ( ! elements . length ) { return ; } force = force || options . forceLoad ; topLazy = Infinity ; var viewportTop = scrollTop ( ) , viewportHeight = window . innerHeight || docElement . clientHeight , viewportWidth = window . innerWidth || docElement . clientWidth , i , length ; for ( i = 0 , length = elements . length ; i < length ; i ++ ) { var $el = elements [ i ] , el = $el [ 0 ] , objData = $el [ lazyLoadXT ] , removeNode = false , visible = force || $data ( el , dataLazied ) < 0 , topEdge ; // remove items that are not in DOM if ( ! $ . contains ( docElement , el ) ) { removeNode = true ; } else if ( force || ! objData . visibleOnly || el . offsetWidth || el . offsetHeight ) { if ( ! visible ) { var elPos = el . getBoundingClientRect ( ) , edgeX = objData . edgeX , edgeY = objData . edgeY ; topEdge = ( elPos . top + viewportTop - edgeY ) - viewportHeight ; visible = ( topEdge <= viewportTop && elPos . <mask> > - edgeY && elPos . left <= viewportWidth + edgeX && elPos . right > - edgeX ) ; } if ( visible ) { $el . on ( load_error , triggerLoadOrError ) ; triggerEvent ( 'show' , $el ) ; var srcAttr = objData . srcAttr , src = $isFunction ( srcAttr ) ? srcAttr ( $el ) : el . getAttribute ( srcAttr ) ; if ( src ) { el . src = src ; } removeNode = true ; } else { if ( topEdge < topLazy ) { topLazy = topEdge ; } } } if ( removeNode ) { $data ( el , dataLazied , 0 ) ; elements . splice ( i -- , 1 ) ; length -- ; } } if ( ! length ) { triggerEvent ( 'complete' , $ ( docElement ) ) ; } }