【发布时间】:2019-08-03 11:33:59
【问题描述】:
我不太了解 Javascript。 id 为“theFixed”的 div 标记一次只能使用一个 javascript 行(最大与最小,但我需要两者同时工作。这是我现在的代码。我将如何放置“最大”和“min”行合二为一。
<script>
$(window).scroll(function(){
$("#theFixed").css("top",Math.max(0,1500-$(this).scrollTop()));
$("#theFixed").css("top",Math.min(0,3000-$(this).scrollTop()));
});
</script>
<div id="theFixed" style="position:fixed;top:2px;bottom:2px;">
<img src="../images/90s/rooms/90s%20room_full_color.png">
</div>`
【问题讨论】:
标签: javascript html position fixed