본문 바로가기
javascript

퀵메뉴 일정 top까지만 움직이게 하기

by 바나냥 2020. 4. 3.
#join-bt {position: fixed; right: 40px; top: 67%; z-index: 99; font-size: 20px; width: 110px; height: 110px; border-radius: 60px; padding-top: 28px; /* margin: 0; */}
#join-bt.abs {position: absolute; right: 40px; top: inherit; bottom: 180px;}​
$(document).ready(function(){
        	
            var quick = $("#join-bt");
            //var qTop = quick.outerHeight();
            var qTop = $(window).height();
            var footerTop = $(".footer_ins").offset().top;
            //alert(qTop);
            $(window).scroll(function() {
            var winTop = $(window).scrollTop();
            var totalTop = winTop + qTop;
            //alert(winTop);
            //alert(footerTop);
            if(totalTop > footerTop) {
            quick.addClass('abs');
            //quick.removeClass('fix');
            /* quick.stop().animate({
            top: winTop + qTop
            }, 400); */
            }else{
            //quick.addClass('fix');
            quick.removeClass('abs');
            } 
            });

})

댓글