1/*! 2 * Name : Just Another Parallax [Jarallax] 3 * Version : 1.9.3 4 * Author : nK <https://nkdev.info> 5 * GitHub : https://github.com/nk-o/jarallax 6 */ 7;(function() { 8'use strict'; 9 10var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 11 12var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; 13 14function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 15 16var supportTransform = function () { 17 var prefixes = 'transform WebkitTransform MozTransform'.split(' '); 18 var div = document.createElement('div'); 19 for (var i = 0; i < prefixes.length; i++) { 20 if (div && div.style[prefixes[i]] !== undefined) { 21 return prefixes[i]; 22 } 23 } 24 return false; 25}(); 26var ua = navigator.userAgent; 27var isAndroid = ua.toLowerCase().indexOf('android') > -1; 28var isIOs = /iPad|iPhone|iPod/.test(ua) && !window.MSStream; 29 30// requestAnimationFrame polyfill 31var rAF = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function (callback) { 32 setTimeout(callback, 1000 / 60); 33}; 34 35// init events 36function addEventListener(el, eventName, handler) { 37 el.addEventListener(eventName, handler); 38} 39 40// Window data 41var wndW = void 0; 42var wndH = void 0; 43var wndY = void 0; 44var forceResizeParallax = false; 45function updateWndVars(e) { 46 wndW = window.innerWidth || document.documentElement.clientWidth; 47 wndH = window.innerHeight || document.documentElement.clientHeight; 48 if ((typeof e === 'undefined' ? 'undefined' : _typeof(e)) === 'object' && (e.type === 'load' || e.type === 'DOMContentLoaded')) { 49 forceResizeParallax = true; 50 } 51} 52updateWndVars(); 53addEventListener(window, 'resize', updateWndVars); 54addEventListener(window, 'orientationchange', updateWndVars); 55addEventListener(window, 'load', updateWndVars); 56addEventListener(window, 'DOMContentLoaded', updateWndVars); 57 58// list with all jarallax instances 59// need to render all in one scroll/resize event 60var jarallaxList = []; 61 62// Animate if changed window size or scrolled page 63var oldPageData = false; 64function updateParallax() { 65 if (!jarallaxList.length) { 66 return; 67 } 68 69 if (window.pageYOffset !== undefined) { 70 wndY = window.pageYOffset; 71 } else { 72 wndY = (document.documentElement || document.body.parentNode || document.body).scrollTop; 73 } 74 75 var isResized = forceResizeParallax || !oldPageData || oldPageData.width !== wndW || oldPageData.height !== wndH; 76 var isScrolled = isResized || !oldPageData || oldPageData.y !== wndY; 77 78 forceResizeParallax = false; 79 80 if (isResized || isScrolled) { 81 jarallaxList.forEach(function (item) { 82 if (isResized) { 83 item.onResize(); 84 } 85 if (isScrolled) { 86 item.onScroll(); 87 } 88 }); 89 90 oldPageData = { 91 width: wndW, 92 height: wndH, 93 y: wndY 94 }; 95 } 96 97 rAF(updateParallax); 98} 99 100var instanceID = 0; 101 102// Jarallax class 103 104var Jarallax = function () { 105 function Jarallax(item, userOptions) { 106 _classCallCheck(this, Jarallax); 107 108 var self = this; 109 110 self.instanceID = instanceID++; 111 112 self.$item = item; 113 114 self.defaults = { 115 type: 'scroll', // type of parallax: scroll, scale, opacity, scale-opacity, scroll-opacity 116 speed: 0.5, // supported value from -1 to 2 117 imgSrc: null, 118 imgElement: '.jarallax-img', 119 imgSize: 'cover', 120 imgPosition: '50% 50%', 121 imgRepeat: 'no-repeat', // supported only for background, not for <img> tag 122 keepImg: false, // keep <img> tag in it's default place 123 elementInViewport: null, 124 zIndex: -100, 125 noAndroid: false,
126 noIos: false, 127 128 // video 129 videoSrc: null, 130 videoStartTime: 0, 131 videoEndTime: 0, 132 videoVolume: 0, 133 videoPlayOnlyVisible: true, 134 135 // events 136 onScroll: null, // function(calculations) {} 137 onInit: null, // function() {} 138 onDestroy: null, // function() {} 139 onCoverImage: null // function() {} 140 }; 141 142 // DEPRECATED: old data-options 143 var deprecatedDataAttribute = self.$item.getAttribute('data-jarallax'); 144 var oldDataOptions = JSON.parse(deprecatedDataAttribute || '{}'); 145 if (deprecatedDataAttribute) { 146 console.warn('Detected usage of deprecated data-jarallax JSON options, you should use pure data-attribute options. See info here - https://github.com/nk-o/jarallax/issues/53'); 147 } 148 149 // prepare data-options 150 var dataOptions = self.$item.dataset || {}; 151 var pureDataOptions = {}; 152 Object.keys(dataOptions).forEach(function (key) { 153 var loweCaseOption = key.substr(0, 1).toLowerCase() + key.substr(1); 154 if (loweCaseOption && typeof self.defaults[loweCaseOption] !== 'undefined') { 155 pureDataOptions[loweCaseOption] = dataOptions[key]; 156 } 157 }); 158 159 self.options = self.extend({}, self.defaults, oldDataOptions, pureDataOptions, userOptions); 160 self.pureOptions = self.extend({}, self.options); 161 162 // prepare 'true' and 'false' strings to boolean 163 Object.keys(self.options).forEach(function (key) { 164 if (self.options[key] === 'true') { 165 self.options[key] = true; 166 } else if (self.options[key] === 'false') { 167 self.options[key] = false; 168 } 169 }); 170 171 // fix speed option [-1.0, 2.0] 172 self.options.speed = Math.min(2, Math.max(-1, parseFloat(self.options.speed))); 173 174 // custom element to check if parallax in viewport 175 var elementInVP = self.options.elementInViewport; 176 // get first item from array 177 if (elementInVP && (typeof elementInVP === 'undefined' ? 'undefined' : _typeof(elementInVP)) === 'object' && typeof elementInVP.length !== 'undefined') { 178 elementInVP = elementInVP[0]; 179 } 180 // check if dom element 181 if (!(elementInVP instanceof Element)) { 182 elementInVP = null; 183 } 184 self.options.elementInViewport = elementInVP; 185 186 self.image = { 187 src: self.options.imgSrc || null, 188 $container: null, 189 useImgTag: false, 190 191 // position fixed is needed for the most of browsers because absolute position have glitches 192 // on MacOS with smooth scroll there is a huge lags with absolute position - https://github.com/nk-o/jarallax/issues/75 193 // on mobile devices better scrolled with absolute position 194 position: isAndroid || isIOs ? 'absolute' : 'fixed' 195 }; 196 197 if (self.initImg() && self.canInitParallax()) { 198 self.init(); 199 } 200 } 201 202 // add styles to element 203 204 205 _createClass(Jarallax, [{ 206 key: 'css', 207 value: function css(el, styles) { 208 if (typeof styles === 'string') { 209 return window.getComputedStyle(el).getPropertyValue(styles); 210 } 211 212 // add transform property with vendor prefix 213 if (styles.transform && supportTransform) { 214 styles[supportTransform] = styles.transform; 215 } 216 217 Object.keys(styles).forEach(function (key) { 218 el.style[key] = styles[key]; 219 }); 220 return el; 221 } 222 223 // Extend like jQuery.extend 224 225 }, { 226 key: 'extend', 227 value: function extend(out) { 228 var _arguments = arguments; 229 230 out = out || {}; 231 Object.keys(arguments).forEach(function (i) { 232 if (!_arguments[i]) { 233 return; 234 } 235 Object.keys(_arguments[i]).forEach(function (key) { 236 out[key] = _arguments[i][key]; 237 }); 238 }); 239 return out; 240 } 241 242 // get window size and scroll position. Useful for extensions 243 244 }, {
245 key: 'getWindowData', 246 value: function getWindowData() { 247 return { 248 width: wndW, 249 height: wndH, 250 y: wndY 251 }; 252 } 253 254 // Jarallax functions 255 256 }, { 257 key: 'initImg', 258 value: function initImg() { 259 var self = this; 260 261 // find image element 262 var $imgElement = self.options.imgElement; 263 if ($imgElement && typeof $imgElement === 'string') { 264 $imgElement = self.$item.querySelector($imgElement); 265 } 266 // check if dom element 267 if (!($imgElement instanceof Element)) { 268 $imgElement = null; 269 } 270 271 if ($imgElement) { 272 if (self.options.keepImg) { 273 self.image.$item = $imgElement.cloneNode(true); 274 } else { 275 self.image.$item = $imgElement; 276 self.image.$itemParent = $imgElement.parentNode; 277 } 278 self.image.useImgTag = true; 279 } 280 281 // true if there is img tag 282 if (self.image.$item) { 283 return true; 284 } 285 286 // get image src 287 if (self.image.src === null) { 288 self.image.src = self.css(self.$item, 'background-image').replace(/^url\(['"]?/g, '').replace(/['"]?\)$/g, ''); 289 } 290 return !(!self.image.src || self.image.src === 'none'); 291 } 292 }, { 293 key: 'canInitParallax', 294 value: function canInitParallax() { 295 return supportTransform && !(isAndroid && this.options.noAndroid) && !(isIOs && this.options.noIos); 296 } 297 }, { 298 key: 'init', 299 value: function init() { 300 var self = this; 301 var containerStyles = { 302 position: 'absolute', 303 top: 0, 304 left: 0, 305 width: '100%', 306 height: '100%', 307 overflow: 'hidden', 308 pointerEvents: 'none' 309 }; 310 var imageStyles = {}; 311 312 if (!self.options.keepImg) { 313 // save default user styles 314 var curStyle = self.$item.getAttribute('style'); 315 if (curStyle) { 316 self.$item.setAttribute('data-jarallax-original-styles', curStyle); 317 } 318 if (self.image.useImgTag) { 319 var curImgStyle = self.image.$item.getAttribute('style'); 320 if (curImgStyle) { 321 self.image.$item.setAttribute('data-jarallax-original-styles', curImgStyle); 322 } 323 } 324 } 325 326 // set relative position and z-index to the parent 327 if (self.css(self.$item, 'position') === 'static') { 328 self.css(self.$item, { 329 position: 'relative' 330 }); 331 } 332 if (self.css(self.$item, 'z-index') === 'auto') { 333 self.css(self.$item, { 334 zIndex: 0 335 }); 336 } 337 338 // container for parallax image 339 self.image.$container = document.createElement('div'); 340 self.css(self.image.$container, containerStyles); 341 self.css(self.image.$container, { 342 'z-index': self.options.zIndex 343 }); 344 self.image.$container.setAttribute('id', 'jarallax-container-' + self.instanceID); 345 self.$item.appendChild(self.image.$container); 346 347 // use img tag 348 if (self.image.useImgTag) { 349 imageStyles = self.extend({ 350 'object-fit': self.options.imgSize, 351 'object-position': self.options.imgPosition, 352 // support for plugin https://github.com/bfred-it/object-fit-images 353 'font-family': 'object-fit: ' + self.options.imgSize + '; object-position: ' + self.options.imgPosition + ';', 354 'max-width': 'none' 355 }, containerStyles, imageStyles); 356 357 // use div with background image 358 } else { 359 self.image.$item = document.createElement('div'); 360 imageStyles = self.extend({ 361 'background-position': self.options.imgPosition, 362 'background-size': self.options.imgSize, 363 'background-repeat': self.options.imgRepeat, 364 'background-image': 'url("' + self.image.src + '")' 365 }, containerStyles, imageStyles); 366 } 367 368 if (self.options.type === 'opacity' || self.options.type === 'scale' || self.options.type === 'scale-opacity' || self.options.speed === 1) { 369 self.image.position = 'absolute'; 370 } 371 372 // check if one of parents have transform style (without this check, scroll transform will be inverted if used parallax with position fixed) 373 // discussion - https://github.com/nk-o/jarallax/issues/9 374 if (self.image.position === 'fixed') { 375 var parentWithTransform = 0; 376 var $itemParents = self.$item; 377 while ($itemParents !== null && $itemParents !== document && parentWithTransform === 0) { 378 var parentTransform = self.css($itemParents, '-webkit-transform') || self.css($itemParents, '-moz-transform') || self.css($itemParents, 'transform'); 379 if (parentTransform && parentTransform !== 'none') { 380 parentWithTransform = 1; 381 self.image.position = 'absolute'; 382 } 383 $itemParents = $itemParents.parentNode; 384 } 385 } 386 387 // add position to parallax block 388 imageStyles.position = self.image.position; 389 390 // insert parallax image 391 self.css(self.image.$item, imageStyles); 392 self.image.$container.appendChild(self.image.$item); 393 394 // set initial position and size 395 self.coverImage(); 396 self.clipContainer(); 397 self.onScroll(true); 398 399 // call onInit event 400 if (self.options.onInit) { 401 self.options.onInit.call(self); 402 } 403 404 // remove default user background 405 if (self.css(self.$item, 'background-image') !== 'none') { 406 self.css(self.$item, { 407 'background-image': 'none' 408 }); 409 } 410 411 self.addToParallaxList(); 412 } 413 414 // add to parallax instances list 415 416 }, {
417 key: 'addToParallaxList', 418 value: function addToParallaxList() { 419 jarallaxList.push(this); 420 421 if (jarallaxList.length === 1) { 422 updateParallax(); 423 } 424 } 425 426 // remove from parallax instances list 427 428 }, { 429 key: 'removeFromParallaxList', 430 value: function removeFromParallaxList() { 431 var self = this; 432 433 jarallaxList.forEach(function (item, key) { 434 if (item.instanceID === self.instanceID) { 435 jarallaxList.splice(key, 1); 436 } 437 }); 438 } 439 }, { 440 key: 'destroy', 441 value: function destroy() { 442 var self = this; 443 444 self.removeFromParallaxList(); 445 446 // return styles on container as before jarallax init 447 var originalStylesTag = self.$item.getAttribute('data-jarallax-original-styles'); 448 self.$item.removeAttribute('data-jarallax-original-styles'); 449 // null occurs if there is no style tag before jarallax init 450 if (!originalStylesTag) { 451 self.$item.removeAttribute('style'); 452 } else { 453 self.$item.setAttribute('style', originalStylesTag); 454 } 455 456 if (self.image.useImgTag) { 457 // return styles on img tag as before jarallax init 458 var originalStylesImgTag = self.image.$item.getAttribute('data-jarallax-original-styles'); 459 self.image.$item.removeAttribute('data-jarallax-original-styles'); 460 // null occurs if there is no style tag before jarallax init 461 if (!originalStylesImgTag) { 462 self.image.$item.removeAttribute('style'); 463 } else { 464 self.image.$item.setAttribute('style', originalStylesTag); 465 } 466 467 // move img tag to its default position 468 if (self.image.$itemParent) { 469 self.image.$itemParent.appendChild(self.image.$item); 470 } 471 } 472 473 // remove additional dom elements 474 if (self.$clipStyles) { 475 self.$clipStyles.parentNode.removeChild(self.$clipStyles); 476 } 477 if (self.image.$container) { 478 self.image.$container.parentNode.removeChild(self.image.$container); 479 } 480 481 // call onDestroy event 482 if (self.options.onDestroy) { 483 self.options.onDestroy.call(self); 484 } 485 486 // delete jarallax from item 487 delete self.$item.jarallax; 488 } 489 490 // it will remove some image overlapping 491 // overlapping occur due to an image position fixed inside absolute position element 492 493 }, { 494 key: 'clipContainer', 495 value: function clipContainer() { 496 // needed only when background in fixed position 497 if (this.image.position !== 'fixed') { 498 return; 499 } 500 501 var self = this; 502 var rect = self.image.$container.getBoundingClientRect(); 503 var width = rect.width; 504 var height = rect.height; 505 506 if (!self.$clipStyles) { 507 self.$clipStyles = document.createElement('style'); 508 self.$clipStyles.setAttribute('type', 'text/css'); 509 self.$clipStyles.setAttribute('id', 'jarallax-clip-' + self.instanceID); 510 var head = document.head || document.getElementsByTagName('head')[0]; 511 head.appendChild(self.$clipStyles); 512 } 513 514 var styles = '#jarallax-container-' + self.instanceID + ' {\n clip: rect(0 ' + width + 'px ' + height + 'px 0);\n clip: rect(0, ' + width + 'px, ' + height + 'px, 0);\n }'; 515 516 // add clip styles inline (this method need for support IE8 and less browsers) 517 if (self.$clipStyles.styleSheet) { 518 self.$clipStyles.styleSheet.cssText = styles; 519 } else { 520 self.$clipStyles.innerHTML = styles; 521 } 522 } 523 }, {
524 key: 'coverImage', 525 value: function coverImage() { 526 var self = this; 527 528 var rect = self.image.$container.getBoundingClientRect(); 529 var contH = rect.height; 530 var speed = self.options.speed; 531 var isScroll = self.options.type === 'scroll' || self.options.type === 'scroll-opacity'; 532 var scrollDist = 0; 533 var resultH = contH; 534 var resultMT = 0; 535 536 // scroll parallax 537 if (isScroll) { 538 // scroll distance and height for image 539 if (speed < 0) { 540 scrollDist = speed * Math.max(contH, wndH); 541 } else { 542 scrollDist = speed * (contH + wndH); 543 } 544 545 // size for scroll parallax 546 if (speed > 1) { 547 resultH = Math.abs(scrollDist - wndH); 548 } else if (speed < 0) { 549 resultH = scrollDist / speed + Math.abs(scrollDist); 550 } else { 551 resultH += Math.abs(wndH - contH) * (1 - speed); 552 } 553 554 scrollDist /= 2; 555 } 556 557 // store scroll distance 558 self.parallaxScrollDistance = scrollDist; 559 560 // vertical center 561 if (isScroll) { 562 resultMT = (wndH - resultH) / 2; 563 } else { 564 resultMT = (contH - resultH) / 2; 565 } 566 567 // apply result to item 568 self.css(self.image.$item, { 569 height: resultH + 'px', 570 marginTop: resultMT + 'px', 571 left: self.image.position === 'fixed' ? rect.left + 'px' : '0', 572 width: rect.width + 'px' 573 }); 574 575 // call onCoverImage event 576 if (self.options.onCoverImage) { 577 self.options.onCoverImage.call(self); 578 } 579 580 // return some useful data. Used in the video cover function 581 return { 582 image: { 583 height: resultH, 584 marginTop: resultMT 585 }, 586 container: rect 587 }; 588 } 589 }, { 590 key: 'isVisible', 591 value: function isVisible() { 592 return this.isElementInViewport || false; 593 } 594 }, { 595 key: 'onScroll', 596 value: function onScroll(force) { 597 var self = this; 598 599 var rect = self.$item.getBoundingClientRect(); 600 var contT = rect.top; 601 var contH = rect.height; 602 var styles = {}; 603 604 // check if in viewport 605 var viewportRect = rect; 606 if (self.options.elementInViewport) { 607 viewportRect = self.options.elementInViewport.getBoundingClientRect(); 608 } 609 self.isElementInViewport = viewportRect.bottom >= 0 && viewportRect.right >= 0 && viewportRect.top <= wndH && viewportRect.left <= wndW; 610 611 // stop calculations if item is not in viewport 612 if (force ? false : !self.isElementInViewport) { 613 return; 614 } 615 616 // calculate parallax helping variables 617 var beforeTop = Math.max(0, contT); 618 var beforeTopEnd = Math.max(0, contH + contT); 619 var afterTop = Math.max(0, -contT); 620 var beforeBottom = Math.max(0, contT + contH - wndH); 621 var beforeBottomEnd = Math.max(0, contH - (contT + contH - wndH)); 622 var afterBottom = Math.max(0, -contT + wndH - contH); 623 var fromViewportCenter = 1 - 2 * (wndH - contT) / (wndH + contH); 624 625 // calculate on how percent of section is visible 626 var visiblePercent = 1; 627 if (contH < wndH) { 628 visiblePercent = 1 - (afterTop || beforeBottom) / contH; 629 } else if (beforeTopEnd <= wndH) { 630 visiblePercent = beforeTopEnd / wndH; 631 } else if (beforeBottomEnd <= wndH) { 632 visiblePercent = beforeBottomEnd / wndH; 633 } 634 635 // opacity 636 if (self.options.type === 'opacity' || self.options.type === 'scale-opacity' || self.options.type === 'scroll-opacity') {
637 styles.transform = 'translate3d(0,0,0)'; 638 styles.opacity = visiblePercent; 639 } 640 641 // scale 642 if (self.options.type === 'scale' || self.options.type === 'scale-opacity') { 643 var scale = 1; 644 if (self.options.speed < 0) { 645 scale -= self.options.speed * visiblePercent; 646 } else { 647 scale += self.options.speed * (1 - visiblePercent); 648 } 649 styles.transform = 'scale(' + scale + ') translate3d(0,0,0)'; 650 } 651 652 // scroll 653 if (self.options.type === 'scroll' || self.options.type === 'scroll-opacity') { 654 var positionY = self.parallaxScrollDistance * fromViewportCenter; 655 656 // fix if parallax block in absolute position 657 if (self.image.position === 'absolute') { 658 positionY -= contT; 659 } 660 661 styles.transform = 'translate3d(0,' + positionY + 'px,0)'; 662 } 663 664 self.css(self.image.$item, styles); 665 666 // call onScroll event 667 if (self.options.onScroll) { 668 self.options.onScroll.call(self, { 669 section: rect, 670 671 beforeTop: beforeTop, 672 beforeTopEnd: beforeTopEnd, 673 afterTop: afterTop, 674 beforeBottom: beforeBottom, 675 beforeBottomEnd: beforeBottomEnd, 676 afterBottom: afterBottom, 677 678 visiblePercent: visiblePercent, 679 fromViewportCenter: fromViewportCenter 680 }); 681 } 682 } 683 }, { 684 key: 'onResize', 685 value: function onResize() { 686 this.coverImage(); 687 this.clipContainer(); 688 } 689 }]); 690 691 return Jarallax; 692}(); 693 694// global definition 695 696 697var plugin = function plugin(items) { 698 // check for dom element 699 // thanks: http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object 700 if ((typeof HTMLElement === 'undefined' ? 'undefined' : _typeof(HTMLElement)) === 'object' ? items instanceof HTMLElement : items && (typeof items === 'undefined' ? 'undefined' : _typeof(items)) === 'object' && items !== null && items.nodeType === 1 && typeof items.nodeName === 'string') { 701 items = [items]; 702 } 703 704 var options = arguments[1]; 705 var args = Array.prototype.slice.call(arguments, 2); 706 var len = items.length; 707 var k = 0; 708 var ret = void 0; 709 710 for (k; k < len; k++) { 711 if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object' || typeof options === 'undefined') { 712 if (!items[k].jarallax) { 713 items[k].jarallax = new Jarallax(items[k], options); 714 } 715 } else if (items[k].jarallax) { 716 // eslint-disable-next-line prefer-spread 717 ret = items[k].jarallax[options].apply(items[k].jarallax, args); 718 } 719 if (typeof ret !== 'undefined') { 720 return ret; 721 } 722 } 723 724 return items; 725}; 726plugin.constructor = Jarallax; 727 728// no conflict 729var oldPlugin = window.jarallax; 730window.jarallax = plugin; 731window.jarallax.noConflict = function () { 732 window.jarallax = oldPlugin; 733 return this; 734}; 735 736// jQuery support 737if (typeof jQuery !== 'undefined') { 738 var jQueryPlugin = function jQueryPlugin() { 739 var args = arguments || []; 740 Array.prototype.unshift.call(args, this); 741 var res = plugin.apply(window, args); 742 return (typeof res === 'undefined' ? 'undefined' : _typeof(res)) !== 'object' ? res : this; 743 }; 744 jQueryPlugin.constructor = Jarallax; 745 746 // no conflict 747 var oldJqPlugin = jQuery.fn.jarallax; 748 jQuery.fn.jarallax = jQueryPlugin; 749 jQuery.fn.jarallax.noConflict = function () { 750 jQuery.fn.jarallax = oldJqPlugin; 751 return this; 752 }; 753} 754 755// data-jarallax initialization 756addEventListener(window, 'DOMContentLoaded', function () { 757 plugin(document.querySelectorAll('[data-jarallax]')); 758}); 759}());
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.