如何在页面加载之前使用 CSS 设置响应滑块的高度
它是什么
一个 jquery Cycle 滑块,在窗口加载和窗口大小调整时,使用 css 和 javascript 的组合来响应式地调整所有内容的大小。
出了什么问题
当页面加载时,滑块在 css 中设置高度为 0(因为在页面加载之前我不知道屏幕尺寸),然后使用 js 调整滑块大小适当的高度并开始运行幻灯片。
然而,这意味着在 js 加载/运行之前,滑块是不可见的,这意味着它“弹出”到视图中,将其下方的内容向下推。这似乎是 Flexslider 或 Cycle 等响应式滑块的普遍问题。
有没有办法使用CSS设置高度?
What is it
A jquery Cycle slider, which, on window load and window resize, uses a combination of css and javascript to resize everything responsively.
What's wrong
When the page loads, the slider has a height of 0 set in the css (because I don't know the screen size until the page has loaded) and then uses js to resize the slider to an appropriate height and start running the slideshow.
However this means that until the js loads/runs, the slider isn't visible, meaning it "pops" into view, pushing the content below it down. This seems to be a general problem with responsive sliders like flexslider or cycle.
Is there a way of setting the height using css?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您正在寻找 Cycle 的版本 2
http://jquery.malsup.com/cycle2 /demo/autoheight.php
I think version 2 of cycle are you looking for
http://jquery.malsup.com/cycle2/demo/autoheight.php