DataLazyload

LazyLoad elements which are out of current viewPort.

parents: Base

defined in: datalazyload.js

Class

Attributes

  • autoDestroy {Boolean} Whether destroy this component when all lazy loaded elements are loaded.
  • containers {HTMLElement[]} Containers which will be monitor scroll event to lazy load elements within it.
  • diff {Number|Object} Distance outside viewport or specified container to pre load.
  • execScript {Boolean} Whether execute script in lazy loaded textarea.
  • placeholder {String} Placeholder img url for lazy loaded _images.

Methods

  • addCallback (el, fn) Register callback function.
  • addElements (els) Add a array of imgs or textareas to be lazy loaded to monitor list.
  • destroy () Destroy this component.Will fire destroy event.
  • DataLazyload. loadCustomLazyData (containers, type, flag) <static> Load lazyload textarea and imgs manually.
  • removeCallback (el, fn) Remove a callback function.
  • removeElements (els) Remove a array of element from monitor list.

Class Detail

  • DataLazyload ()
    LazyLoad elements which are out of current viewPort.

Attributes Detail

  • autoDestroy {Boolean} Whether destroy this component when all lazy loaded elements are loaded. Default : true
  • containers {HTMLElement[]} Containers which will be monitor scroll event to lazy load elements within it. Default : [ document ]
  • diff {Number|Object} Distance outside viewport or specified container to pre load. Default : pre load one screen height and width.
    Example
    • 
       diff : 50 // pre load 50px outside viewport or specified container
       // or more detailed :
       {
         left:20, // pre load 50px outside left edge of viewport or specified container
         right:30, // pre load 50px outside right edge of viewport or specified container
         top:50, // pre load 50px outside top edge of viewport or specified container
         bottom:60 // pre load 50px outside bottom edge of viewport or specified container
       }
      
  • execScript {Boolean} Whether execute script in lazy loaded textarea. Default : true
  • placeholder {String} Placeholder img url for lazy loaded _images. Default : empty

Methods Detail

  • addCallback (el, fn) view source
    Register callback function. When el is in viewport, then fn is called.
    Parameters
    •   el {HTMLElement|String} Html element to be monitored.
    •   fn {Function} Callback function to be called when el is in viewport.
  • addElements (els) view source
    Add a array of imgs or textareas to be lazy loaded to monitor list.
    Parameters
    •   els {HTMLElement[]} Array of imgs or textareas to be lazy loaded
    Since
    1.3
  • destroy () view source
    Destroy this component.Will fire destroy event.
  • DataLazyload. loadCustomLazyData (containers, type, flag) <static> view source
    Load lazyload textarea and imgs manually.
    Parameters
    •   containers {HTMLElement[]} Containers with in which lazy loaded elements are loaded.
    •   type {String} Type of lazy loaded element. "img" or "textarea"
    • [ flag ] {String} flag which will be searched to find lazy loaded elements from containers. Default "data-ks-lazyload-custom" for img attribute and "ks-lazyload-custom" for textarea css class.
  • removeCallback (el, fn) view source
    Remove a callback function. See DataLazyload#addCallback
    Parameters
    •   el {HTMLElement|String} Html element to be monitored.
    • [ fn ] {Function} Callback function to be called when el is in viewport. If not specified, remove all callbacks associated with el.
    Since
    1.3
  • removeElements (els) view source
    Remove a array of element from monitor list. See DataLazyload#addElements.
    Parameters
    •   els {HTMLElement[]} Array of imgs or textareas to be lazy loaded
    Since
    1.3
blog comments powered by Disqus
Top