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