UNPKG

12.8 kBSource Map (JSON)View Raw
1{"version":3,"sources":["webpack://__FOUNDATION_EXTERNAL__.[name]/webpack/universalModuleDefinition","webpack://__FOUNDATION_EXTERNAL__.[name]/webpack/bootstrap","webpack:/__FOUNDATION_EXTERNAL__.[name]/external {\"root\":[\"__FOUNDATION_EXTERNAL__\",\"foundation.core\"],\"amd\":\"./foundation.core\",\"commonjs\":\"./foundation.core\",\"commonjs2\":\"./foundation.core\"}","webpack://__FOUNDATION_EXTERNAL__.[name]/js/entries/plugins/foundation.smoothScroll.js","webpack://__FOUNDATION_EXTERNAL__.[name]/js/foundation.smoothScroll.js","webpack:/__FOUNDATION_EXTERNAL__.[name]/external {\"root\":[\"jQuery\"],\"amd\":\"jquery\",\"commonjs\":\"jquery\",\"commonjs2\":\"jquery\"}"],"names":["root","factory","exports","module","require","define","amd","window","__WEBPACK_EXTERNAL_MODULE__foundation_core__","__WEBPACK_EXTERNAL_MODULE_jquery__","installedModules","__webpack_require__","m","r","__webpack_exports__","_foundation_core__WEBPACK_IMPORTED_MODULE_0__","d","_foundation_smoothScroll__WEBPACK_IMPORTED_MODULE_1__","Foundation","plugin","SmoothScroll","Plugin","element","options","this","$element","$","extend","defaults","data","className","_init","id","GetYoDigits","attr","_events","_linkClickListener","_handleLinkClick","bind","on","e","_this","currentTarget","is","arrival","getAttribute","_inTransition","scrollToLoc","preventDefault","off","loc","arguments","length","undefined","callback","$loc","scrollPos","Math","round","offset","top","threshold","stop","animate","scrollTop","animationDuration","animationEasing","c","name","getter","o","Object","defineProperty","enumerable","get","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","n","object","property","prototype","hasOwnProperty","call","p","s","moduleId","i","l","modules"],"mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,EAAAG,QAAA,qBAAAA,QAAA,WACA,mBAAAC,QAAAA,OAAAC,IACAD,OAAA,CAAA,oBAAA,UAAAJ,GACA,iBAAAC,QACAA,Q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AN,EAAAlE,EAAAK,EAAAiE,EAAAE,EAAA,SAAAA,GAAgH,OAAAN,EAAAM,IAAqB7C,KAAA,KAAA6C,IACrI,OAAAF,GAIAtE,EAAAyE,EAAA,SAAAjF,GACA,IAAAkE,EAAAlE,GAAAA,EAAA6E,WACA,WAA2B,OAAA7E,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAQ,EAAAK,EAAAqD,EAAA,IAAAA,GACAA,GAIA1D,EAAA2D,EAAA,SAAAe,EAAAC,GAAsD,OAAAf,OAAAgB,UAAAC,eAAAC,KAAAJ,EAAAC,IAGtD3E,EAAA+E,EAAA,GAIA/E,EAAAA,EAAAgF,EAAA,IA9EA,SAAAhF,EAAAiF,GAGA,GAAAlF,EAAAkF,GACA,OAAAlF,EAAAkF,GAAA1F,QAGA,IAAAC,EAAAO,EAAAkF,GAAA,CACAC,EAAAD,EACAE,GAAA,EACA5F,QAAA,IAUA,OANA6F,EAAAH,GAAAH,KAAAtF,EAAAD,QAAAC,EAAAA,EAAAD,QAAAS,GAGAR,EAAA2F,GAAA,EAGA3F,EAAAD,cAvBAQ","file":"foundation.smoothScroll.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"./foundation.core\"), require(\"jquery\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"./foundation.core\", \"jquery\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"foundation.smoothScroll\"] = factory(require(\"./foundation.core\"), require(\"jquery\"));\n\telse\n\t\troot[\"__FOUNDATION_EXTERNAL__\"] = root[\"__FOUNDATION_EXTERNAL__\"] || {}, root[\"__FOUNDATION_EXTERNAL__\"][\"foundation.smoothScroll\"] = factory(root[\"__FOUNDATION_EXTERNAL__\"][\"foundation.core\"], root[\"jQuery\"]);\n})(window, function(__WEBPACK_EXTERNAL_MODULE__foundation_core__, __WEBPACK_EXTERNAL_MODULE_jquery__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 16);\n","module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_core__;","import { Foundation } from './foundation.core';\n\nimport { SmoothScroll } from '../../foundation.smoothScroll';\nFoundation.plugin(SmoothScroll, 'SmoothScroll');\n\nexport { Foundation, SmoothScroll };\n","import $ from 'jquery';\nimport { GetYoDigits } from './foundation.core.utils';\nimport { Plugin } from './foundation.core.plugin';\n\n/**\n * SmoothScroll module.\n * @module foundation.smoothScroll\n */\nclass SmoothScroll extends Plugin {\n /**\n * Creates a new instance of SmoothScroll.\n * @class\n * @name SmoothScroll\n * @fires SmoothScroll#init\n * @param {Object} element - jQuery object to add the trigger to.\n * @param {Object} options - Overrides to the default plugin settings.\n */\n _setup(element, options) {\n this.$element = element;\n this.options = $.extend({}, SmoothScroll.defaults, this.$element.data(), options);\n this.className = 'SmoothScroll'; // ie9 back compat\n\n this._init();\n }\n\n /**\n * Initialize the SmoothScroll plugin\n * @private\n */\n _init() {\n const id = this.$element[0].id || GetYoDigits(6, 'smooth-scroll');\n this.$element.attr({ id });\n\n this._events();\n }\n\n /**\n * Initializes events for SmoothScroll.\n * @private\n */\n _events() {\n this._linkClickListener = this._handleLinkClick.bind(this);\n this.$element.on('click.zf.smoothScroll', this._linkClickListener);\n this.$element.on('click.zf.smoothScroll', 'a[href^=\"#\"]', this._linkClickListener);\n }\n\n /**\n * Handle the given event to smoothly scroll to the anchor pointed by the event target.\n * @param {*} e - event\n * @function\n * @private\n */\n _handleLinkClick(e) {\n // Follow the link if it does not point to an anchor.\n if (!$(e.currentTarget).is('a[href^=\"#\"]')) return;\n\n const arrival = e.currentTarget.getAttribute('href');\n\n this._inTransition = true;\n\n SmoothScroll.scrollToLoc(arrival, this.options, () => {\n this._inTransition = false;\n });\n\n e.preventDefault();\n };\n\n /**\n * Function to scroll to a given location on the page.\n * @param {String} loc - A properly formatted jQuery id selector. Example: '#foo'\n * @param {Object} options - The options to use.\n * @param {Function} callback - The callback function.\n * @static\n * @function\n */\n static scrollToLoc(loc, options = SmoothScroll.defaults, callback) {\n const $loc = $(loc);\n\n // Do nothing if target does not exist to prevent errors\n if (!$loc.length) return false;\n\n var scrollPos = Math.round($loc.offset().top - options.threshold / 2 - options.offset);\n\n $('html, body').stop(true).animate(\n { scrollTop: scrollPos },\n options.animationDuration,\n options.animationEasing,\n () => {\n if (typeof callback === 'function'){\n callback();\n }\n }\n );\n }\n\n /**\n * Destroys the SmoothScroll instance.\n * @function\n */\n _destroy() {\n this.$element.off('click.zf.smoothScroll', this._linkClickListener)\n this.$element.off('click.zf.smoothScroll', 'a[href^=\"#\"]', this._linkClickListener);\n }\n}\n\n/**\n * Default settings for plugin.\n */\nSmoothScroll.defaults = {\n /**\n * Amount of time, in ms, the animated scrolling should take between locations.\n * @option\n * @type {number}\n * @default 500\n */\n animationDuration: 500,\n /**\n * Animation style to use when scrolling between locations. Can be `'swing'` or `'linear'`.\n * @option\n * @type {string}\n * @default 'linear'\n * @see {@link https://api.jquery.com/animate|Jquery animate}\n */\n animationEasing: 'linear',\n /**\n * Number of pixels to use as a marker for location changes.\n * @option\n * @type {number}\n * @default 50\n */\n threshold: 50,\n /**\n * Number of pixels to offset the scroll of the page on item click if using a sticky nav bar.\n * @option\n * @type {number}\n * @default 0\n */\n offset: 0\n}\n\nexport {SmoothScroll}\n","module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;"]}
\No newline at end of file