admin管理员组文章数量:1277887
Is there an easy way to have a "glass pane" all over the HTML page, regardless of zoom/slide events/platform/browser{mobile/desktop}?
By "easy" I mean something like pure CSS support, not a plug-in.
Fallback: plug-in advice might be useful as well.
Thanks
Is there an easy way to have a "glass pane" all over the HTML page, regardless of zoom/slide events/platform/browser{mobile/desktop}?
By "easy" I mean something like pure CSS support, not a plug-in.
Fallback: plug-in advice might be useful as well.
Thanks
Share Improve this question asked Jan 31, 2012 at 12:24 Alexander AbramovichAlexander Abramovich 11.5k26 gold badges74 silver badges113 bronze badges 1- Do you mean a layer on top of everything? – MMM Commented Jan 31, 2012 at 12:25
3 Answers
Reset to default 6If you just mean a layer on top of everything, try this:
#top-layer {
position: fixed;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
top: 0;
left: 0;
}
You can set opacity: 0.5;
if you want it semi-transparent.
A jsFiddle example
I would use a class to do this.
div.glass-pane {
width: 100%;
height: 100%;
z-index: 10;
position: fixed;
top: 0;
left: 0;
margin: 0;
padding: 0;
}
You can change the height, width, top, and left position to make the "glass pane" only fit over a certain area. Also you can add some color (rgba or hsla would be the best and create a glass effect). The z-index will help if you want to create a modal box on top of the pane. Then just use jQuery to add click events.
I recently published a Chrome Extension that uses this effect (here is the source).
A glass pane? Try this CSS:
div#glassPane {
height: 98%;
width: 98%;
border: 1px solid rgba(0,0,0,0.5);
border-radius: 10px;
background: rgba(0,0,0,0.25);
box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px rgba(255,255,255,0.3), inset 0 10px rgba(255,255,255,0.2), inset 0 10px 20px rgba(255,255,255,0.25), inset 0 -15px 30px rgba(0,0,0,0.3);
position: fixed;
top: 1%;
left: 1%;
}
See here for an example: http://jsfiddle/vLTWK/
See here for more:
http://dev.opera./articles/view/beautiful-ui-styling-with-css3-text-shadow-box-shadow-and-border-radius/#glassbox
本文标签: javascriptGlass pane all over the pageStack Overflow
版权声明:本文标题:javascript - Glass pane all over the page - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741216786a2360196.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论