1/*! 2 * ScriptName: shared.js 3 * 4 * FoodConnection 5 * http://foodconnection.jp/ 6 * http://foodconnection.vn/ 7 * 8 */ 9 10 11$(document).ready(function() { 12 if($('.nav-fixed[scroll-active]').length && $('.nav-fixed').attr('scroll-active') === "true") 13 $(document).on('scroll', onScroll) 14 $('.nav-fixed a[href*="#"]').on('click', function(){ 15 var e = $(this).attr('href') 16 var h = $('.nav-fixed').outerHeight() 17 var b = $(e).length ? $(e).offset().top : 0 18 $('html, body').animate({ 19 scrollTop: (b + 1 - h) 20 }, 500) 21 }) 22}); 23 24$(document).ready(function () { 25 new WOW().init(); 26 $(window).scroll(function () { 27 var TargetPos = $('.section').offset().top; 28 var ScrollPos = $(window).scrollTop(); 29 if (ScrollPos > TargetPos) { 30 $("body").addClass('has-nav'); 31 } else { 32 $("body").removeClass('has-nav'); 33 } 34 }); 35}); 36 37var lastScrollTop = 0; 38 39$(window).scroll(function(){ 40 var st = $(this).scrollTop(); 41 if (lastScrollTop !=0 ) 42 { 43 if (st < lastScrollTop){ 44 $("#pagetop").addClass("visible"); 45 if(st < 10){ 46 $("#pagetop").removeClass("visible"); 47 } 48 } 49 else if (st > lastScrollTop){ 50 51 $("#pagetop").removeClass("visible"); 52 53 } 54 } 55 lastScrollTop = st; 56}); 57 58 59$("body").on("click", "#pagetop, .p-top", function() { 60 if (!$(this).hasClass("in-scroll")) { 61 $(this).addClass("in-scroll"); 62 63 var $scrollDuration = $.inArray($(this).attr("data-duration"), ["slow", "normal", "fast"]) >= 0 || parseInt($(this).attr("data-duration")) > 0 ? $(this).attr("data-duration") : "slow"; 64 65 $("html, body").stop().animate({ 66 scrollTop: 0 67 }, $scrollDuration, function() { 68 $("#pagetop, .p-top").removeClass("in-scroll"); 69 $("#pagetop, .p-top").removeClass("visible"); 70 }); 71 72 } 73}); 74// END: scroll to top 75 76 77 78 79$(document).ready(function () { 80// var viewportSet = function () { 81if (screen.width <= 767) { 82 $("body").addClass('viewport'); 83 $('.sub-nav nav').hide(); 84 $('.sub-nav .sub').click(function() { 85 $(this).toggleClass('active'); 86 $('+nav', this).slideToggle(); 87 }); 88 89} 90// }; 91// viewportSet(); 92 93// $(window).on('load resize orientationchange', function() { 94// viewportSet(); 95// }); 96 97}); 98 99$(window).scroll(function() { 100 var scrollDistance = $(window).scrollTop() - 800; 101 var ww = document.body.clientWidth; 102 if(ww <= 767) { 103 var scrollDistance = $(window).scrollTop() - 400; 104 } 105 // Show/hide menu on scroll 106 //if (scrollDistance >= 850) { 107 // $('nav').fadeIn("fast"); 108 //} else { 109 // $('nav').fadeOut("fast"); 110 //} 111 112 // Assign active class to nav links while scolling 113 $('.sec-scroll').each(function(i) { 114 if ($(this).position().top <= scrollDistance) { 115 $('.header-nav .nav > li a.active').removeClass('active'); 116 $('.header-nav .nav > li a').eq(i).addClass('active'); 117 } 118 }); 119 }).scroll(); 120 121//fix scroll ios 122var overflowIsHidden = function(node) { 123 var style = getComputedStyle(node); 124 return style.overflow === "hidden" || style.overflowX === "hidden" || style.overflowY === "hidden"; 125} 126var isItScrollableWithoutVisibleScrollbars = function(el) { 127 if (el === null) return false; 128 var isScrollable = false, 129 hasScrollbars = false; 130 isScrollable = el.scrollHeight > el.offsetHeight ? true : false; // first, lets find out if it has scrollable content 131 // isScrollable = el.scrollHeight + 1 > el.clientHeight ? true : false; // first, lets find out if it has scrollable content 132 if (isScrollable) hasScrollbars = (el.offsetWidth > el.scrollWidth) ? true : false; // if it's scrollable, let's see if it likely has scrollbars 133 // if (isScrollable) hasScrollbars = (el.offsetWidth > el.scrollWidth - 1) ? true : false; // if it's scrollable, let's see if it likely has scrollbars 134 if (isScrollable && !hasScrollbars && !overflowIsHidden(el)) return true; 135 else return false; 136}; 137document.addEventListener("touchmove", function(e) { 138 if (document.body.classList.contains("navopen") && !isItScrollableWithoutVisibleScrollbars(document.getElementById("menu-toggle"))) e.preventDefault(); 139}, { 140 passive: false 141});
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.