/** * @author Kim Bokhee */ function btnTop(){ $('html, body').stop().animate({ scrollTop: 0 }, 300); } function btnScroll(obj, sp, bp) { var tp, mp, wh, dh; $(window).scroll(function(){ tp = $(window).scrollTop(); dh = $(document).height(); wh = $(window).height(); mp = (wh - bp) + tp; if(tp > sp){ $(obj).stop().animate({ top: mp }, 300); } else if(mp >= dh){ mp = dh - bp; $(obj).stop().animate({ top: mp }, 300); } else { $(obj).stop().animate({ top: sp }, 300); } }); } function btnJumping(obj, mp) { $(obj).parent().children().removeClass('on'); $(obj).addClass('on'); $('html, body').stop().animate({ scrollTop: mp }, 300); } function contentChange(gnb, content){ for (var i=0; i < gnb.length; i++) { $(gnb[i]).click({i:i}, function(e){ $(content).hide(); $(content[e.data.i]).show(); }); }; } function gnbScrollFollow(gnb, sp){ $(window).scroll(function(){ var wp = $(window).scrollTop(); if(wp <= sp) { $(gnb).removeClass('fix'); } else { $(gnb).addClass('fix'); } }); }