30 lines
882 B
JavaScript
30 lines
882 B
JavaScript
|
// JavaScript Document
|
||
|
|
||
|
(function() {
|
||
|
let winW = $(window).width();
|
||
|
let headerH = $('header').outerHeight();
|
||
|
let bannerH = $('.bannerArea').height();
|
||
|
|
||
|
let htmlbody = $('html, body');
|
||
|
let main = $('.mainArea');
|
||
|
let header = $("header");
|
||
|
let footerTop = $('footer .top');
|
||
|
|
||
|
footerTop.on("click", function(){
|
||
|
htmlbody.animate({
|
||
|
scrollTop: 0
|
||
|
}, 1000);
|
||
|
});
|
||
|
|
||
|
$(window).scroll(function() {
|
||
|
let winScroll = $(window).scrollTop();
|
||
|
|
||
|
if(winScroll > bannerH && winW > 1180) {
|
||
|
main.css('padding-top',headerH);
|
||
|
header.addClass('fixed');
|
||
|
} else {
|
||
|
main.css('padding-top','0px');
|
||
|
header.removeClass('fixed');
|
||
|
}
|
||
|
})
|
||
|
})($)
|