jQuery(function($){ function getScrollBarWidth(){ if($(document).height() > $(window).height()){ $('body').append('
'); fakeScrollBar = $('#fakescrollbar'); fakeScrollBar.append('
 
'); var w1 = fakeScrollBar.find('div').innerWidth(); fakeScrollBar.css('overflow-y', 'scroll'); var w2 = $('#fakescrollbar').find('div').html('html is required to init new width.').innerWidth(); fakeScrollBar.remove(); return (w1-w2); } return 0; } /* Header Fixed */ $(window).scroll(function () { var scrollHeight = $(window).scrollTop(); var startTop = $("#header").height(); if ( scrollHeight > startTop ) { $("#header").addClass("fixed"); }else { $("#header").removeClass("fixed"); } }); /* gotoTop */ $(document).ready(function(){ $(".gotoTop").click(function(){ TweenMax.to($("html, body"), 0.5, {scrollTop:0, ease:Power3.easeOut}); }); $(window).scroll(function(){ lnbScroll(); if($(window).width() > 1183){ if($(window).scrollTop() > 0){ $(".gotoTop").fadeIn(500); }else{ $(".gotoTop").fadeOut(500); } if($(window).scrollTop() + $(window).height() >= $("#footer").offset().top){ $(".gotoTop").css({"position":"absolute", "bottom":0}); }else{ $(".gotoTop").css({"position":"fixed", "bottom":0}); } }else{ if($(window).scrollTop() + $(window).height() >= $("#footer").offset().top){ $(".gotoTop").fadeIn(500); $(".gotoTop").css({"position":"absolute", "bottom":0}); }else{ $(".gotoTop").fadeOut(500); } } }); }); function lnbScroll(){ $(window).resize(function(){ var scrollTop = $(window).scrollTop(); if(scrollTop >= $().innerHeight()){ $().css({"top":"0"}); }else if(scrollTop < $().innerHeight()){ $().css({"top":""}); } }); $(window).resize(); } /* Scrollbar */ $(".custom-scrollbar-wrapper").on("touchmove click",function () { $(this).find(".custom-scrollbar-cover").fadeOut(200); }); /* AOS */ AOS.init({ easing: 'ease', duration: 1000 }); /* hljs.initHighlightingOnLoad(); $('.hero__scroll').on('click', function(e) { $('html, body').animate({ scrollTop: $(window).height() }, 1200); }); */ });