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