WebPublisher/JavaScript & jQuery
[jQuery] 배너 sticky 이벤트
amanda
2022. 8. 17. 17:45
CSS
.fixed{
position: fixed;
left: 0;
bottom: 0;
z-index: 2;
width: 100%;
background-color: #fff;
padding-bottom: 0;
}
jQuery
$(document).ready(function(){
if(wWidth < 1025){
bannerSticky(70);
}else{
bannerSticky(100);
}
function bannerSticky(top){
$(window).scroll(function(e){
if($(window).scrollTop() + $(window).height() > $(document).height() - top){
$('.sponsor-banner, #footer').removeClass('fixed');
}else{
$('.sponsor-banner, #footer').addClass('fixed');
}
});
}
})