File: doc/Navease.min.js

Recommend this page to a friend!
  Classes of Mark Rolich   JavaScript AJAX Loader Animation   doc/Navease.min.js   Download  
File: doc/Navease.min.js
Role: Auxiliary script
Content type: text/plain
Description: Documentation js file
Class: JavaScript AJAX Loader Animation
Animate a wait indicator for long time tasks
Author: By
Last change: first commit
Date: 2 years ago
Size: 994 bytes
 

Contents

Class file image Download
var Navease=function(n,e,o){"use strict";var i=0,t=void 0!==n?n:30,a=void 0!==e?e:"easeInOutQuad",r=0,l=0,c=0,u=null,d="-navease",s=void 0!==o?o:"a[name]";if(void 0===Easing[a])throw"Easing "+a+" is not defined";if(1>n)throw"Minimum frame count is 1";var w=function(){if(void 0!==window.addEventListener){var n,e=document.querySelectorAll(s);for(n in e)e.hasOwnProperty(n)&&e[n].setAttribute("name",e[n].getAttribute("name")+d);window.addEventListener("hashchange",h)}},m=function(n){var e='a[name="'+n+'"]',o='a[name="'+n+d+'"]',i=document.querySelector(e)||document.querySelector(o);r=window.scrollY||document.documentElement.scrollTop,null!==i&&(i.scrollIntoView(),c=window.scrollY||document.documentElement.scrollTop,r!==c&&window.scroll(0,r))},v=function(){i=0,u=null},f=function(){l=Easing[a](i,r,-(r-c),t),window.scroll(0,l),t>i?(u=window.requestAnimationFrame(f),i+=1):v()},h=function(){m(window.location.hash.substring(1)),null!==u&&window.cancelAnimationFrame(u),v(),r!==c&&f()};w()};