1/*! 2* ScriptName: shared.js 3* 4* FoodConnection 5* http://foodconnection.jp/ 6* http://foodconnection.vn/ 7* 8*/ 9 10$(document).ready(function() { 11 12 var TargetPos = 50; 13 $(window).scroll(function () { 14 var ScrollPos = $(window).scrollTop(); 15 if (ScrollPos > TargetPos) { 16 $("body").addClass('has_nav'); 17 } else { 18 $("body").removeClass('has_nav'); 19 } 20 }); 21 22 23// let vh = window.innerHeight * 0.01; 24// document.documentElement.style.setProperty('--vh', '${vh}px'); 25// window.addEventListener('resize', () => { 26// let vh = window.innerHeight * 0.01; 27// document.documentElement.style.setProperty('--vh', '${vh}px'); 28// }); 29 30}); 31$(function() { 32 $('body').removeClass('navOpen'); 33 $(".hamburger").click(function() { 34 if ($('body').hasClass('navOpen')) { 35 $('body').addClass('navClose'); 36 $('body').removeClass('navOpen'); 37 $('body').css('position', 'static'); 38 $(window).scrollTop(offsetY); 39 $(".hamburger").removeClass('is-active'); 40 41 } else { 42 $('body').addClass('navOpen'); 43 $('body').removeClass('navClose'); 44 45 offsetY = window.pageYOffset; 46 $('body').css({ 47 position: 'fixed', 48 width: '100%', 49 'top': -offsetY + 'px' 50 }); 51 52 $(".hamburger").addClass('is-active'); 53 return false; 54 } 55 }); 56 57 $("#menu_toggle a").click(function() { 58 $('body').removeClass('navOpen'); 59 $('body').addClass('navClose'); 60 $(".hamburger").removeClass('is-active'); 61 $('body').css('position', 'static'); 62 }); 63}); 64//fix scroll ios 65var overflowIsHidden = function(node) { 66 var style = getComputedStyle(node); 67 return style.overflow === "hidden" || style.overflowX === "hidden" || style.overflowY === "hidden"; 68} 69 70var isItScrollableWithoutVisibleScrollbars = function(el) { 71 if (el === null) return false; 72 73 var isScrollable = false, 74 hasScrollbars = false; 75 76 isScrollable = el.scrollHeight > el.offsetHeight ? true : false; // first, lets find out if it has scrollable content 77 // isScrollable = el.scrollHeight + 1 > el.clientHeight ? true : false; // first, lets find out if it has scrollable content 78 79 if (isScrollable) hasScrollbars = (el.offsetWidth > el.scrollWidth) ? true : false; // if it's scrollable, let's see if it likely has scrollbars 80 // if (isScrollable) hasScrollbars = (el.offsetWidth > el.scrollWidth - 1) ? true : false; // if it's scrollable, let's see if it likely has scrollbars 81 82 if (isScrollable && !hasScrollbars && !overflowIsHidden(el)) return true; 83 else return false; 84}; 85// 86//document.addEventListener("touchmove", function(e) { 87// if (document.body.classList.contains("nav--opened") && !isItScrollableWithoutVisibleScrollbars(document.getElementById("menu_toggle"))) e.preventDefault(); 88//}, { 89// passive: false 90//}); 91 92document.addEventListener("touchmove", function(e) { 93 if (document.body.classList.contains("nav--opened")) { 94 if (!isItScrollableWithoutVisibleScrollbars(document.getElementById("menu_toggle")) || $(e.target).parents("#menu_toggle").length < 1) e.preventDefault(); 95 } 96}, { 97 passive: false 98}); 99 100 101window.addEventListener("resize", function() { 102 var _event_ = new Event("touchmove"); 103 104 document.dispatchEvent(_event_); // trigger 105}, { 106 passive: false 107}); 108// END: fix scroll iOS 109 110 111 112$(document).ready(function () { 113 if ($('.nav-fixed[scroll-active]').length && $('.nav-fixed').attr('scroll-active') === "true") 114 $(document).on('scroll', onScroll) 115 $('.nav-fixed a[href*="#"] , #menu_toggle ul li a[href^="#"]').on('click', function () { 116 console.log(1) 117 var e = $(this).attr('href') 118 var h = $(window).width() > 1000 ? $('.nav-fixed').outerHeight() : 0 119 var b = $(e).length ? $(e).offset().top : 0 120 $('html, body').animate({ 121 scrollTop: (b + 1 - h) 122 }, 500) 123 // if($('body').hasClass('nav--opened')){ 124 // $("body").removeClass("nav--opened"); 125 // $("body").addClass("has_nav"); 126 // $(".hamburger").removeClass("is-active"); 127 // // // Clear ALL 128 // // bodyScrollLock.clearAllBodyScrollLocks(); 129 // } 130 return false;
131 }) 132}); 133 134function onScroll() { 135 var scroll = $(window).scrollTop() 136 var header = $('.nav-fixed').outerHeight() 137 var element = $(window).width() > 1000 ? '.nav-fixed a[href^="#"]' : '#menu_toggle ul li a[href^="#"]' 138 $(element).each(function () { 139 var el = $(this).attr('href') 140 var offset = $(el).length ? $(el).offset().top : 0 141 // if ($(this).find('img').length) { 142 // var _src_ = $(this).find('img').attr("src"); 143 // _src_ = _src_.replace(/^(.*?)_on\.(.*)$/, "$1.$2"); 144 // $(this).find('img').attr("src", _src_) 145 // } 146 if ((scroll + header) >= offset && ($(el).outerHeight() + offset) > (scroll + header)) { 147 $(element).removeClass('active') 148 $(this).addClass('active') 149 if ($(this).find('img').length) { 150 // $(element + ' img').addClass('btn') 151 // $(this).find('img').removeClass('btn') 152 $(element + ' img').each(function () { 153 var src = $(this).attr('src') 154 var newSrc = src.replace('_on', '') 155 $(this).attr('src', newSrc) 156 }) 157 $(this).find('img').attr("src").match(/^(.*)(\.{1}.*)/g); 158 var newSrc = RegExp.$1 + "_on" + RegExp.$2; 159 $(this).find('img').attr("src", newSrc); // update src 160 161 } 162 // $(this).find('img').trigger('mouseout').trigger('mouseover') 163 } 164 }) 165} 166if(navigator.userAgent.match(/Trident\/7\./)) { 167 $('body').on("mousewheel", function () { 168 event.preventDefault(); 169 var wd = event.wheelDelta; 170 var csp = window.pageYOffset; 171 window.scrollTo(0, csp - wd); 172 }); 173 }
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.