Html 滚动到修复-使用剽窃
我正试图在我的项目中使用它。 这是我的 这是我的js代码:Html 滚动到修复-使用剽窃,html,scroll,position,fixed,absolute,Html,Scroll,Position,Fixed,Absolute,我正试图在我的项目中使用它。 这是我的 这是我的js代码: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script> <script src="jquery-scrolltofixed-min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
<script src="jquery-scrolltofixed-min.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
// first two divs
$('#side').scrollToFixed({
marginTop: $('.zel_bg').outerHeight(true) + 55,
limit: $('.indbag').offset().top - $('#side').outerHeight(true) - 20,
});
$('#esp').scrollToFixed({
marginTop: $('.zel_bg').outerHeight(true) + 55,
limit: $('.indbag').offset().top - $('#esp').outerHeight(true) - 20,
});
// second two divs
$('#ss1').scrollToFixed({
marginTop: $('.zel_bg').outerHeight(true) + 55,
limit: $('.oforbag').offset().top - $('#ss1').outerHeight(true) - 20,
});
$('#ss2').scrollToFixed({
marginTop: $('.zel_bg').outerHeight(true) + 55,
limit: $('.oforbag').offset().top - $('#ss2').outerHeight(true) - 20,
});
});
</script>
$(文档).ready(函数(){
//前两个分区
$(“#侧”)。滚动至固定({
玛金托普:$('.zel_bg').outerHeight(真)+55,
限制:$('.indbag').offset().top-$('#side').outerHeight(true)-20,
});
$('#esp')。滚动固定({
玛金托普:$('.zel_bg').outerHeight(真)+55,
限制:$('.indbag').offset().top-$('#esp').outerHeight(true)-20,
});
//第二组
$('#ss1')。滚动固定({
玛金托普:$('.zel_bg').outerHeight(真)+55,
限制:$('.oforbag').offset().top-$('#ss1').outerHeight(true)-20,
});
$('#ss2')。滚动固定({
玛金托普:$('.zel_bg').outerHeight(真)+55,
限制:$('.oforbag').offset().top-$('#ss2').outerHeight(true)-20,
});
});
这是真的,当它计算位置,然后使位置:固定为div。
当它计算divs位置的位置时是正确的:绝对。
但div的位置在最后(底部)部分是错误的
乍一看,它们似乎已经消失了。
但代码计算出了在底部放置块的错误高度
剽窃的代码是错的?或者我该如何修复它?
我的页面高度是流动的,我不能给它固定像素数。
我想,这个剽窃的“ScrollToFixed”会对我有所帮助。
但是我有我之前告诉过你的问题。请添加更多细节。.我添加了更多细节。我只是使用了完整的javascript,没有任何更改,结果是错误的