$(function () { //$('.lazy').Lazy(); }); $.pjax.defaults.maxCacheLength = 0; $.pjax.defaults.timeout = false; $.pjax.defaults.scrollTo = true; function pjax_action() { $(document).on("click", "*[data-link=inlink]", function () { $.pjax({ url: $(this).attr('href'), fragment: '#main', container: '#main' }); return false; }); } document.addEventListener("DOMContentLoaded", function (event) { pjax_action(); }); $(document).on("pjax:timeout", function () { return false; }); $(document).on('pjax:complete', function () { $('html, body').scrollTop(0); $(".c-loading").css("display", "none"); console.log("pjax comlete: " + location); window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'Pageview', 'url': location }); //$('.lazy').Lazy(); $.getScript("/Assets/js/lazyload.min.js"); }); $(document).on('pjax:end', function () { window.scrollTo(0, 0); $("*[data-link=inlink]").off("click"); }); $(document).on('pjax:beforeSend', function () { $(".c-loading").css("display", "block"); });