1$(function(){ 2 //ua 3 var ua = navigator.userAgent; 4 $unique = $('#oneplay-gifted'); 5 6 if($unique.length) { 7 8 $unique.removeClass('hide'); 9 10 //header 11 $unique.find('header .btnMenu').click(function() { 12 $menuThisScroll = $(window).scrollTop(); 13 $(this).parents('header').addClass('open'); 14 $('body').addClass('fixed'); 15 $('body').css({top: -$menuThisScroll + 'px'}); 16 }); 17 $unique.find('header .btnClose').click(function() { 18 $('body').removeClass('fixed'); 19 $('body').removeAttr('style'); 20 $(window).scrollTop($menuThisScroll); 21 $(this).parents('header').removeClass('open'); 22 }); 23 $unique.find('header .menu li a').click(function(){ 24 if($(this).attr('data-target')){ 25 $('body').removeClass('fixed'); 26 $('body').removeAttr('style'); 27 $(window).scrollTop($menuThisScroll); 28 $(this).parents('header').removeClass('open'); 29 let target = $(this).attr('data-target'); 30 target = $('#'+target).offset().top; 31 $('body, html').animate({scrollTop : target}, 1000); 32 } 33 }); 34 35 //slider 36 let sliderAnimation = function(){ 37 $sliderNum = $('.slider li').length; 38 //reset 39 if($('.slider li.current').length >= 2) { 40 $('.slider li').removeClass('current'); 41 $('.slider li').eq(0).addClass('current'); 42 } 43 //slide 44 $sliderThisNum = $('.slider li.current').index(); 45 $('.slider li').removeClass('current'); 46 if($sliderThisNum >= $sliderNum -1) { 47 $('.slider li').eq(0).addClass('current'); 48 }else{ 49 $('.slider li').eq($sliderThisNum+1).addClass('current'); 50 } 51 } 52 if($unique.find('.slider')) { 53 setInterval(function(){ 54 sliderAnimation(); 55 },5000); 56 } 57 58 //fadein 59 let fadein = function(){ 60 $thisScroll = $(window).scrollTop(); 61 $thisScroll = $thisScroll + $(window).height(); 62 $.each($positions, function(index, value) { 63 if( $thisScroll >= value + 100) { 64 $unique.find('.fade').eq(index).addClass('in'); 65 }else if( $thisScroll <= value - 200 ){ 66 if(!$('body').hasClass('fixed')){ 67 $unique.find('.fade').eq(index).removeClass('in'); 68 } 69 } 70 }); 71 console.log($thisScroll); 72 } 73 $fadeTarget = [ 74 '.titleMain', '.boxSection .copy', '.cont .copy', '.boxSection p', '.boxSection img', '.boxBorder', '.boxCont', '.contents .boxBtn', 75 '.listPulldown', '.boxSupportSystem', '.listStaff li >.box', 76 '.listSchool .titleSchool', '.listSchool .imgMain', '.listSchool .listImg', '.listSchool .boxDetails', 77 '.listBlog >li', '.cont >.listBlogCat', '.single.boxTitle', '.cont .boxText', 78 '.boxContact', '.listMembership li', 79 '.notFound p', '.notFound .boxBtn', 80 ]; 81 $.each($fadeTarget, function(index, value) { 82 $unique.find(value).addClass('fade'); 83 }); 84 if($unique.find('.fade')) { 85 $positions = []; 86 $unique.find('.fade').each(function(){ 87 $thisPosition = $(this).offset().top; 88 $positions.push($thisPosition); 89 fadein(); 90 }); 91 $(window).scroll(function(){ 92 fadein(); 93 }); 94 $(window).resize(function(){ 95 fadein(); 96 }); 97 } 98 99 //pulldown 100 $unique.find('.boxPulldown >dt').click(function() { 101 if($(this).parents('.boxPulldown').hasClass('open')){ 102 $(this).parents('.boxPulldown').removeClass('open'); 103 }else{ 104 $(this).parents('.boxPulldown').addClass('open'); 105 } 106 }); 107 $unique.find('.boxPulldown .btnClose').click(function() { 108 if($(this).parents('.boxPulldown').hasClass('open')){ 109 $(this).parents('.boxPulldown').removeClass('open'); 110 $position = $(this).parents('.boxPulldown').offset().top; 111 if($position - 200 <= $(window).scrollTop()) { 112 if($(this).parents('.boxPulldown').hasClass('long')) { 113 $('body, html').animate({scrollTop: $position - 200}, 1000); 114 }else{ 115 $('body, html').animate({scrollTop: $position - 200}, 500); 116 } 117 } 118 } 119 });
120 121 //modal 122 $unique.find('.listStaff li .box').click(function() { 123 $modalThisScroll = $(window).scrollTop(); 124 $(this).parents('li').find('.modal').addClass('open'); 125 $('body').addClass('fixed'); 126 $('body').css({top: -$modalThisScroll + 'px'}); 127 128 }); 129 $unique.find('.modal .btnClose').click(function() { 130 $('body').removeClass('fixed'); 131 $('body').removeAttr('style'); 132 $(window).scrollTop($modalThisScroll); 133 $(this).parents('.modal').removeClass('open'); 134 }); 135 $unique.find('.modal .modalBg').click(function() { 136 $('body').removeClass('fixed'); 137 $('body').removeAttr('style'); 138 $(window).scrollTop($modalThisScroll); 139 $(this).parents('.modal').removeClass('open'); 140 }); 141 } 142});
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.