1(function($) { 2 "use strict"; 3 $.fn.parallax = function(options) { 4 5 var windowHeight = $(window).height(); 6 7 // Establish default settings 8 var settings = $.extend({ 9 speed : 0.20 10 }, options); 11 12 // Iterate over each object in collection 13 return this.each( function() { 14 15 // Save a reference to the element 16 var $this = $(this); 17 var params = { 18 windowWidth: 0, 19 scrollTop: 0, 20 offset: 0, 21 height: 0, 22 yBgPosition: 0 23 } 24 // Set up Scroll Handler 25 $(document).scroll(function(){ 26 27 params.scrollTop = $(window).scrollTop(); 28 params.offset = $this.offset().top; 29 params.height = $this.outerHeight(); 30 params.windowWidth = $(window).width(); 31 32 // Check if above or below viewport 33 if (params.offset + params.height <= params.scrollTop || params.offset >= params.offset + windowHeight) { 34 return; 35 } 36 37 params.yBgPosition = Math.round((params.offset - params.scrollTop) * settings.speed); 38 39 if( params.windowWidth <= 360 ){ params.yBgPosition = 0; } 40
41 // Apply the Y Background Position to Set the Parallax Effect 42 //$this.css('background-position', 'center ' + yBgPosition + 'px'); 43 $this.css('cssText', 'background-position: center ' + params.yBgPosition + 'px !important; background-attachment: fixed !important; background-size: cover !important;'); 44 }).trigger('scroll'); 45 }); 46 } 47 48jQuery(document).ready(function ($) { 49 "use strict"; 50 var window_height = $(window).height(); 51 $('.stripe-parallax-bg').each(function () { 52 var $this = $(this), 53 speedFactor = $this.data('parallax-speed'); 54 $this.css({ 55 'background-attachment': 'fixed', 56 'background-size': 'cover' 57 }).parallax({ 58 speed : speedFactor 59 }); 60 }); 61 /*Video parallax*/ 62 $('.stripe-parallax-video').each(function () { 63 var $this = $(this),$video = $this.find('video'),speedFactor=$(this).data('parallax-speed')||0.7,ratio=0,video_bottom=0; 64 var video_height = 0; 65 var el_height = $(this).outerHeight(); 66 $video.bind('loadeddata', function(){ 67 adjustvideo(); 68 doScroll(); 69 }); 70 var adjustvideo = function(){ 71 ratio = $video.data('ratio'); 72 //video_height = $(window).width() / ratio; 73 video_height = el_height + (el_height + window_height) * (1 - speedFactor); 74 if (video_height < $(window).width() / ratio) { 75 video_height = $(window).width() / ratio 76 } 77 $video.css({ 78 'width': video_height * ratio + 'px', 79 'maxWidth': video_height * ratio + 'px', 80 bottom: 0 81 }); 82 } 83 if (speedFactor == 1) return; 84 var doScroll = function(){ 85 if ($(window).width() < 768) return; 86 $video.attr( 87 { 88 'appear':isappears($this), 89 'delta':Math.round(isappears($this) * (1-speedFactor)) 90 } 91 ); 92 var delta = Math.round(isappears($this) * (1-speedFactor)); 93 $video.css({ 94 bottom: (0 - delta) + 'px' 95 }) 96 }; 97 adjustvideo(); 98 doScroll(); 99 $(window).bind('scroll', doScroll).bind('resize',function(){ 100 adjustvideo(); 101 doScroll(); 102 }).trigger('scroll'); 103 }) 104 function playVideo(video){ 105 if (video.get(0).paused == true) { 106 video.get(0).play(); 107 } else { 108 video.get(0).pause(); 109 } 110 } 111 function pauseVideo(video){ 112 if (video.get(0).paused != true) { 113 video.get(0).pause(); 114 } 115 } 116 /*End Video btn */ 117 $('.custom-bg-video').each(function(){ 118 var $this = $(this); 119 if($('.tb-videobg-control-btn',$this).length > 0){ 120 var video = $this.find('video'); 121 var content = $this.find('.stripe-video-content'); 122 123 video.bind("ended pause", function() { 124 content.css({opacity: 0, visibility: "visible"}).animate({opacity: 1.0, visibility: "hidden"}, 200); 125 $(this).addClass('video-pause').removeClass('video-play'); 126 }); 127 video.bind("play", function() { 128 content.css({opacity: 1.0, visibility: "hidden"}).animate({opacity: 0, visibility: "visible"}, 200); 129 $(this).addClass('video-pause').removeClass('video-pause'); 130 }); 131 $('.tb-videobg-control-btn',$this).click(function(e){ 132 //console.log('click button'); 133 e.stopPropagation(); 134 playVideo(video); 135 }) 136 $('.ww-video-bg,.stripe-video-content,video',$this).click(function(e){ 137 e.stopPropagation(); 138 playVideo(video); 139 }) 140 } 141 }) 142 function isappears(element) { 143 var scrolltop = $(window).scrollTop(),top = $(element).offset().top; 144 if(top < $(window).height()){ 145 return scrolltop; 146 } 147 if ((scrolltop + $(window).height()) >= ($(element).offset().top)) { 148 return scrolltop + $(window).height() - $(element).offset().top; 149 } 150 return 0; 151 } 152}); 153 154}(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.