HTML 检查溢出 - 文本位置
I made a sidebar with custom sliders and what I want to do is change the image of slider when the sidebar scrolled to top/bottom. I have a overflow:hidden but I don't know how to check if it's on the bottom or top.
-- David
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这当然取决于您如何实现滑块(您添加的链接效果不太好),但例如,如果它位于顶部时发生的变化只是它与嵌套的 div 顶部的距离,那么只需添加每当滑块完成移动时都会检查
top
或bottom
CSS 属性是否等于 0,如下所示:It depends of course on how you implement your slider (The link you added doesn't work too well) but for example, if what changes when it's on the top is simply it's distance from the top of the div it's nested in then simply add a check whenever the slider finishes it's movement to check if the
top
orbotttom
CSS property is equal to 0, as done here: