商城結算按鈕樣式,情況如下:
![](https://img.laitimes.com/img/9ZDMuAjOiMmIsIjOiQnIsIiZpdmLxYzN3IzM1UTM3IzMwEjMwIzLc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.gif)
$.fn.smartFloatBottom = function() {
let position = function(element) {
let top = element.position().top,
height = element.height(),
pos = element.css("position"),
wh = window.innerHeight;
if(wh < top + height){
element.css({
position: "fixed",
bottom: 0
});
}
$(window).scroll(function() {
let scrolls = $(this).scrollTop();
if (scrolls + wh < top + height) {
element.css({
position: "fixed",
bottom: 0
});
}else {
element.css({
position: pos
});
}
});
};
return $(this).each(function() {
position($(this));
});
};
$(".FloatBarHolder").smartFloatBottom();