实现效果如下:
js代码实现如下:
var a = $("body").height(); var b = $(window).height(); var c = a - b - $(".footer").height(); $(window).scroll(function() { if ($(window).scrollTop() > c) { $(".jiesuan-box").css("position", "static"); } else { $(".jiesuan-box").css("position", "fixed"); } });