我正在建立一个网站,我在其中放置了一个滚动动画,其中图标图像根据右侧容器内容的偏移位置向上移动.逻辑很有效,但动画片和Firefox中的动画不稳定.
代码逻辑是这样的:
$(window).scroll(function() {
var height = $(window).height(),
scroll = $(window).scrollTop()
var offsetStart = $('#cardContent').offset();
if (initialOffSetStartPosition.top >= (offsetStart.top -scroll - 1) ) {
$(".nav-sticky").offset({top:offsetStart.top});
}
});
Run Code Online (Sandbox Code Playgroud)
有帮助吗?