} else { $("#moveside").addClass("moveside2") } } else { console.log('小于'); if ('undefined' == typeof(document.body.style.maxHeight)) { $("#moveside").css({ 'position': 'absolute', 'top': toTopHeight + 'px' }) } else { $("#moveside").removeClass("moveside2") } } }) }); /*********TAB切换按钮**********************/ $("#tab li").click(function() { var index = $(this).index(); $(this).parents().next().find(".tab-box").hide().eq(index).show(); $(".tab_con .item").eq(index).show().siblings().hide(); $(this).addClass("tab-current").siblings().removeClass("tab-current"); }); /*********底部返回顶部按钮*****************/ $gototop = { template: '
', init: function() { $(document.body).append(this.template); $(window).scroll(function() { $(window).scrollTop() > 100 ? $("#go-top").fadeIn(600) : $("#go-top").fadeOut(600) }); $("#go-top").bind("click", function() { $("body,html").animate({ scrollTop: 0 }, 1e3) }) } }; $gototop.init();