How to use vanilla-lazyload - 9 common examples

To help you get started, we’ve selected a few vanilla-lazyload examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fbnlsr / primative.net / assets / js / main.js View on Github external
grecaptcha.reset();
              },
              error: function (err) {
                console.log(err);
              },
              complete: function() {
                $(this).find('.is-submit-btn').removeClass('is-loading');
              }
            });

            return false;
        }
    });

    // Lazyload covers
    var myLazyLoad = new LazyLoad({
        elements_selector: ".lazy"
    });

    // Making blog post notification appear after some time
    let heyListen = document.getElementById('heyListen');
    if (heyListen) {
        window.setTimeout(() => {
            heyListen.classList.add('is-active');
            window.setTimeout(() => {
                heyListen.classList.remove('is-active');
            }, 30000);
        }, 10000);

        // Making notification disapear on click
        let closeListen = document.getElementById('closeListen');
        closeListen.addEventListener('click', () => {
github apache / incubator-echarts-doc / src / directive / lazyload.js View on Github external
inserted(el) {
        el._lazyload = new LazyLoad({
            container: el,
            elements_selector: 'iframe',
            load_delay: 300
        });
        // doLazyLoad(el);
    },
    update(el) {
github apache / incubator-echarts-doc / src / components / DocContent.vue View on Github external
created() {
        // Root page.
        getPageTotalDescAsync('').then(rootPageDescMap => {
            this.rootPageDescMap = Object.freeze(rootPageDescMap);
        });

        this._lazyload = new LazyLoad({
            elements_selector: 'iframe',
            load_delay: 300
        });

        this.updateCurrentPath(this.shared.currentPath, true);
    },
github AdventureLookup / AdventureLookup / app / Resources / webpack / js / adventures.js View on Github external
(function () {
  if (!$("#search-results").length) {
    return;
  }

  const myLazyLoad = new LazyLoad();

  // Load more adventures
  let currentPage = 1;
  const $loadMoreBtn = $("#load-more-btn");
  $loadMoreBtn.click(function () {
    $loadMoreBtn.attr("disabled", true);
    $loadMoreBtn.find(".fa-spin").removeClass("d-none");

    const $searchForm = $("#search-form");
    const data = $searchForm.serialize() + "&page=" + ++currentPage;
    $.ajax({
      method: "POST",
      url: $searchForm.attr("action"),
      data: data,
    })
      .done(function (result) {
github department-of-veterans-affairs / vets-website / src / applications / static-pages / static-pages-entry.js View on Github external
});

createDisabilityFormWizard(store, widgetTypes.DISABILITY_APP_STATUS);

createFacilityListWidget();
createFacilityDetailWidget();
createBasicFacilityListWidget();
createFacilityPatientSatisfactionScoresWidget();

// homepage widgets
if (location.pathname === '/') {
  createMyVALoginWidget(store);
}

/* eslint-disable no-unused-vars,camelcase */
const lazyLoad = new LazyLoad({
  elements_selector: '.lazy',
});
/* eslint-enable */

vanilla-lazyload

LazyLoad is a lightweight (2.4 kB) and flexible script that speeds up your web application by deferring the loading of your below-the-fold images, videos and iframes to when they will enter the viewport. It's written in plain "vanilla" JavaScript, it leve

MIT
Latest version published 18 days ago

Package Health Score

82 / 100
Full package analysis

Popular vanilla-lazyload functions