UNPKG

foundation-sites

Version:

The most advanced responsive front-end framework in the world.

3 lines (2 loc) 4.96 kB
((t,e)=>{"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./foundation.core"),require("jquery")):"function"==typeof define&&define.amd?define(["./foundation.core","jquery"],e):"object"==typeof exports?exports.__FOUNDATION_EXTERNAL__=e(require("./foundation.core"),require("jquery")):(t.__FOUNDATION_EXTERNAL__=t.__FOUNDATION_EXTERNAL__||{},t.__FOUNDATION_EXTERNAL__["foundation.smoothScroll"]=e(t.__FOUNDATION_EXTERNAL__["foundation.core"],t.jQuery))})(self,function(e,o){return r={"./js/foundation.smoothScroll.js":function(t,e,o){o.r(e),o.d(e,{SmoothScroll:function(){return n}});var e=o("jquery"),r=o.n(e),i=o("./foundation.core");function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,e){for(var o=0;o<e.length;o++){var n=e[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,(t=>(t=((t,e)=>{if("object"!=u(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);if("object"!=u(o=o.call(t,e||"default")))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==u(t)?t:t+""))(n.key),n)}}function c(t,e,o){e=a(e);var n=t,e=f()?Reflect.construct(e,o||[],a(t).constructor):e.apply(t,o);if(!e||"object"!=u(e)&&"function"!=typeof e){if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(e=n))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function f(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(f=function(){return!!t})()}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var n=(t=>{function n(){var t=this,e=n;if(t instanceof e)return c(this,n,arguments);throw new TypeError("Cannot call a class as a function")}var e,o=n;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");return o.prototype=Object.create(t&&t.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),Object.defineProperty(o,"prototype",{writable:!1}),t&&s(o,t),o=n,t=[{key:"scrollToLoc",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n.defaults,o=2<arguments.length?arguments[2]:void 0,t=r()(t);if(!t.length)return!1;t=Math.round(t.offset().top-e.threshold/2-e.offset);r()("html, body").stop(!0).animate({scrollTop:t},e.animationDuration,e.animationEasing,function(){"function"==typeof o&&o()})}}],(e=[{key:"_setup",value:function(t,e){this.$element=t,this.options=r().extend({},n.defaults,this.$element.data(),e),this.className="SmoothScroll",this._init()}},{key:"_init",value:function(){var t=this.$element[0].id||(0,i.GetYoDigits)(6,"smooth-scroll");this.$element.attr({id:t}),this._events()}},{key:"_events",value:function(){this._linkClickListener=this._handleLinkClick.bind(this),this.$element.on("click.zf.smoothScroll",this._linkClickListener),this.$element.on("click.zf.smoothScroll",'a[href^="#"]',this._linkClickListener)}},{key:"_handleLinkClick",value:function(t){var e,o=this;r()(t.currentTarget).is('a[href^="#"]')&&(e=t.currentTarget.getAttribute("href"),this._inTransition=!0,n.scrollToLoc(e,this.options,function(){o._inTransition=!1}),t.preventDefault())}},{key:"_destroy",value:function(){this.$element.off("click.zf.smoothScroll",this._linkClickListener),this.$element.off("click.zf.smoothScroll",'a[href^="#"]',this._linkClickListener)}}])&&l(o.prototype,e),t&&l(o,t),Object.defineProperty(o,"prototype",{writable:!1}),o})(i.Plugin);n.defaults={animationDuration:500,animationEasing:"linear",threshold:50,offset:0}},"./foundation.core":function(t){t.exports=e},jquery:function(t){t.exports=o}},i={},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},l={},(n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})})(l),n.d(l,{Foundation:function(){return t.Foundation},SmoothScroll:function(){return u.SmoothScroll}}),t=n("./foundation.core"),u=n("./js/foundation.smoothScroll.js"),t.Foundation.plugin(u.SmoothScroll,"SmoothScroll"),l;function n(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},r[t](e,e.exports,n)),e.exports}var r,i,t,u,l}); //# sourceMappingURL=foundation.smoothScroll.min.js.map