开发者

CSS overlay on page with scrollbar

开发者 https://www.devze.com 2023-02-26 05:53 出处:网络
I have made overlay for my page, but it has one 开发者_StackOverflow中文版problem, when you scroll down the page, contet you can see by scrolling scrollbar doesn\'t have overlay on it. Is it possible

I have made overlay for my page, but it has one 开发者_StackOverflow中文版problem, when you scroll down the page, contet you can see by scrolling scrollbar doesn't have overlay on it. Is it possible to prevent this anyway?

See example here, just scroll down and see what is the problem.

http://jsfiddle.net/qXwTY/


Set .overlay { ... position:fixed;

You can read this article to understand more css positionning: CSS Positioning 101


On the overlay div:

position: fixed;

Instead of absolute :)


position: fixed not supported in old browsers specially IE 7. But you can do that through jQuery:

$(document).ready(function(){
$(".overlay").css({"height":$(".contents").innerHeight() + 20 + "px"});
});
0

精彩评论

暂无评论...
验证码 换一张
取 消