jQuery (maybe) horizontally fix element, but vertically scroll it

a 夏天 提交于 2019-12-12 02:43:40

问题


I know I've seen this done somewhere, but I can't find it anywhere.

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.


回答1:


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;}

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 -->


来源:https://stackoverflow.com/questions/3938679/jquery-maybe-horizontally-fix-element-but-vertically-scroll-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!