vendor: 4,291 bytes, lines 1-126
1/** 2 * jQuery.enllax.js v1.1.0 3 * https://github.com/mmkjony/enllax.js 4 * demo: http://mmkjony.github.io/enllax.js/ 5 * 6 * Copyright 2015, MMK Jony 7 * This content is released under the MIT license 8 **/ 9 10(function($){ 11 'use strict'; 12 13 $.fn.enllax = function(opt){ 14 15 var elem = $('[data-enllax-ratio]'); 16 elem.each(function(){ 17 var $this = $(this); 18 $this.css({ 19 'position': 'relative', 20 'left': '0', 21 'right': '0' 22 }); 23 }); 24 25 var winHeight = $(window).height(); 26 27 var options = $.extend({ 28 ratio: 0, 29 type: 'background', //foreground 30 direction: 'vertical', //horizontal 31 offset: 0 32 }, opt); 33 34 elem.each(function(){ 35 var ratio; 36 var type; 37 var dir; 38 var offset; 39 var $this = $(this); 40 var docHeight = $(document).height(); 41 var offsettop = $this.offset().top; 42 var height = $this.outerHeight(); 43 var dataRat = $this.data('enllax-ratio'); 44 var dataType = $this.data('enllax-type'); 45 var dataDir = $this.data('enllax-direction'); 46 var dataOffset = $this.data('enllax-offset'); 47 48 if(dataRat) { 49 ratio = dataRat; 50 } 51 else { ratio = options.ratio; } 52 53 if(dataType) { 54 type = dataType; 55 } 56 else { type = options.type; } 57 58 if(dataDir) { 59 dir = dataDir; 60 } 61 else { dir = options.direction; } 62 63 if(dataOffset) { 64 offset = dataOffset; 65 } 66 else { offset = options.offset; } 67 68 var bgY = Math.round(offsettop * ratio); 69 var transform = Math.round( ( offsettop - ( winHeight / 2 ) ) * ratio - offset ); 70 71 if(type == 'background') { 72 if(dir == 'vertical') { 73 $this.css({ 74 'background-position': 'center ' + -bgY + 'px' 75 }); 76 } 77 else if(dir == 'horizontal') { 78 $this.css({ 79 'background-position': -bgY + 'px' + ' center' 80 }); 81 } 82 } 83 else if(type == 'foreground') { 84 if(dir == 'vertical') { 85 $this.css({ 86 '-webkit-transform': 'translateY(' + transform + 'px)', 87 '-moz-transform': 'translateY(' + transform + 'px)', 88 'transform': 'translateY(' + transform + 'px)', 89 'position': 'absolute', 90 'left': '0', 91 'right': '0' 92 }); 93 } 94 else if(dir == 'horizontal') { 95 $this.css({ 96 '-webkit-transform': 'translateX(' + transform + 'px)', 97 '-moz-transform': 'translateX(' + transform + 'px)', 98 'transform': 'translateX(' + transform + 'px)' 99 }); 100 } 101 } 102 103 $(window).on('scroll', function(){ 104 var docHeight = $(document).height(); 105 var offsettop = $this.offset().top; 106 var height = $this.outerHeight(); 107 var scrolling = $(this).scrollTop(); 108 109 bgY = Math.round((offsettop - scrolling) * ratio); 110 transform = Math.round( ( ( offsettop - ( winHeight / 2 ) ) - scrolling ) * ratio - offset ); 111 112 if(type == 'background') { 113 if(dir == 'vertical') { 114 $this.css({ 115 'background-position': 'center ' + -bgY + 'px' 116 }); 117 } 118 else if(dir == 'horizontal') { 119 $this.css({ 120 'background-position': -bgY + 'px' + ' center' 121 }); 122 } 123 } 124 else if((type == 'foreground') && (scrolling < docHeight)) { 125 if(dir == 'vertical') { 126 $this.css({
127 '-webkit-transform': 'translateY(' + transform + 'px)', 128 '-moz-transform': 'translateY(' + transform + 'px)', 129 'transform': 'translateY(' + transform + 'px)', 130 'position': 'absolute', 131 'left': '0', 132 'right': '0' 133 }); 134 } 135 else if(dir == 'horizontal') { 136 $this.css({ 137 '-webkit-transform': 'translateX(' + transform + 'px)', 138 '-moz-transform': 'translateX(' + transform + 'px)', 139 'transform': 'translateX(' + transform + 'px)' 140 }); 141 } 142 } 143 }); 144 }); 145 146 }; 147 148})(jQuery); 149 150jQuery(function() { 151 jQuery(window).enllax(); 152});
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.