admin管理员组文章数量:1206016
Actually, two questions:
- How can I create a modal popup with background color of gray?
- Also I need to create for a cover background color only to table itself. Not to overall page.
How do I do this using javascript and css?
Actually, two questions:
- How can I create a modal popup with background color of gray?
- Also I need to create for a cover background color only to table itself. Not to overall page.
How do I do this using javascript and css?
Share Improve this question edited Jan 10, 2013 at 8:58 Rais Alam 7,01612 gold badges55 silver badges84 bronze badges asked May 5, 2009 at 4:02 kumarkumar 1,12714 gold badges34 silver badges60 bronze badges 3- 1 Had to unwind that question a little. – cgp Commented May 5, 2009 at 4:06
- 2 Duplicate of the question you asked on April 7th: stackoverflow.com/questions/724103/… – Jordan S. Jones Commented May 5, 2009 at 4:22
- 3 Guess it wasn't that urgent after all.. – Mike Robinson Commented May 7, 2009 at 18:34
2 Answers
Reset to default 10Here is the HTML, which should probably be inserted with JS, and the styles should be in an external stylesheet.
<div style="background: gray; width: 200px; height: 200px; position: absolute; left: 50%; top: 50%; margin-left: -100px; margin-top: -100px" id="modal">I'm a modal</div>
Then, you could leverage jQuery to display it.
$('a.modal').bind('click', function(event) {
event.preventDefault();
$('#modal').fadeIn(800);
});
This is only a start, you'll want to learn from this and build upon it. For example, the script should check is(':hidden')
and show, and if not then fadeOut(800)
or similiar.
I use this for the mask that sits on top of the screen
.Mask {
display: none;
width: 100%;
height: 100%;
z-index: 9000;
padding: 0px;
margin: 0px;
background: transparent url(http://i.imgur.com/0KbiL.png);
position: fixed;
top: 0px;
overflow: hidden;
}
本文标签: htmlHow to create a modal popup using javascript and CSSStack Overflow
版权声明:本文标题:html - How to create a modal popup using javascript and CSS - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738713403a2108330.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论