悬浮窗,回到顶部
//悬浮窗
$(window).scroll(function () {
if ($(this).scrollTop() > 245) {
$('.jszb-side_ewm').addClass('head-fix')
} else {
$('.jszb-side_ewm').removeClass('head-fix')
}
})
var winWidth = window.innerWidth || document.documentElement.clientWidth;
if (winWidth > 1500) {
$('.jszb-side_ewm').show()
}
//返回顶部
$('body').on('click', '.gotop', function () {
$('html,body').stop(1).animate({
scrollTop: '0'
}, 300);
return false;
});
.jszb-side_ewm .head-fix{ position: fixed; top: 0;}