jQuery(也许)水平固定元素,但垂直滚动它 [英] jQuery (maybe) horizontally fix element, but vertically scroll it
问题描述
我知道我已经在某个地方看到了它,但是在任何地方都找不到它.
I know I've seen this done somewhere, but I can't find it anywhere.
基本上,我有一个侧面滚动条(在这里: http://www.allisonnavon.com )正在放在一起.
Basically, I have a side scroller (here: http://www.allisonnavon.com) that I'm putting together.
主要问题是,如果浏览器窗口的高度太短,站点将垂直滚动并掩盖本应固定的标题.
The main problem is if the browser window is just a bit too short on height, the site will scroll vertically and cover up the title that is supposed to be fixed.
我想另一种可能性是,如果窗口的高度与站点不匹配,则可以自动调整图像的大小,但是我想避免这种情况.谢谢.
I guess the other possibility is to auto-resize the images if the window's height doesn't match the site, but I want to avoid that if I can. Thanks.
推荐答案
这是一个快速而肮脏的解决方案,将以下类添加到您的CSS中
Here is a quick and dirty solution add the following class to your css
.shader {position:fixed; width: 100%; height: 160px;background: #F9F6E5; top: 0px;left: 0px;}
和该类的div宽度紧接在打开容器的div之后
and a div width this class just after the opening container div
<div class="container">
<!--add this -->
<div class="shader"></div>
<!--end add -->
<!-- text and image -->
这篇关于jQuery(也许)水平固定元素,但垂直滚动它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!