keenc
4/14/2020 - 3:33 AM

侧边栏滚动

alert(jQuery(window).scrollTop()); //用于定位位置
jQuery(window).on("scroll",
function() {
    if (jQuery(window).scrollTop() >3382) { //数字通过上面的jQuery(window).scrollTop()测出
        jQuery('#fixed-form').addClass('fix');
    } else {
        jQuery('#fixed-form').removeClass('fix');
    }
});

// 响应式代码
@media (min-width: 1200px){
.fix {
    position: fixed;
    top: 10%;
    max-width: 353px;
}
}