用于弹出Web屏幕的jQuery Lightbox / Modal Windows [英] jQuery Lightbox/Modal Windows for a Pop-Up Web Screen
问题描述
在我的网络应用程序中,我正在考虑创建一个页面的弹出屏幕,供用户进行一些处理。
Within my web application, I was thinking of creating a pop-up screen of a page for a user to do some processing in.
我基本上想要这个页面就像一个向下钻取的窗口,根据您从顶级摘要记录中按下的按钮显示详细的回复。
I basically want this page to be like a drill-down window of displaying detailed reords based on a button you press from a top-level summary record.
而不是弹出窗口,我是思考一个jQuery灯箱功能/模态窗口。
Instead of a pop-up, I was thinking of a jQuery lightbox feature / modal window.
我愿意接受建议和简单的灯箱示例,用于显示网页而不是照片,几乎是一个流行音乐 - 窗口,但具有jQuery外观和感觉,即放大到用户然后缩小到摘要记录的东西。
I'm open for suggestions and good easy examples of lightboxes for displaying web screen and not a photo, pretty much a pop-up window, but with a jQuery look and feel, i.e something that zooms in to the user and then zooms back out to the summary record.
希望有人可以协助examples / urls等。
Hope someone can assist with examples/urls etc.
谢谢。
Tony。
Thanks. Tony.
推荐答案
试试这个例子,
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Simple JQuery Modal Window from Queness</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
<script>
$(document).ready(function() {
//select all the a tag with name equal to modal
$('a[name=modal]').click(function(e) {
//Cancel the link behavior
e.preventDefault();
//Get the A tag
var id = $(this).attr('href');
//Get the screen height and width
var maskHeight = $(document).height();
var maskWidth = $(window).width();
//Set heigth and width to mask to fill up the whole screen
$('#mask').css({'width':maskWidth,'height':maskHeight});
//transition effect
$('#mask').fadeIn(1000);
$('#mask').fadeTo("slow",0.8);
//Get the window height and width
var winH = $(window).height();
var winW = $(window).width();
//Set the popup window to center
$(id).css('top', winH/2-$(id).height()/2);
$(id).css('left', winW/2-$(id).width()/2);
//transition effect
$(id).fadeIn(2000);
});
//if close button is clicked
$('.window .close').click(function (e) {
//Cancel the link behavior
e.preventDefault();
$('#mask').hide();
$('.window').hide();
});
});
</script>
<style>
body {
font-family:verdana;
font-size:15px;
}
a {color:#333; text-decoration:none}
a:hover {color:#ccc; text-decoration:none}
#mask {
position:absolute;
left:0;
top:0;
z-index:9000;
background-color:#000;
display:none;
}
#boxes .window {
position:absolute;
left:0;
top:0;
width:440px;
height:200px;
display:none;
z-index:9999;
padding:20px;
}
#boxes #dialog {
width:375px;
height:203px;
padding:10px;
background-color:#ffffff;
}
</style>
</head>
<body>
<h2>Simple jQuery Modal Window</h2>
<ul>
<li><a href="#dialog" name="modal">Simple Window Modal</a></li>
</ul>
<div id="boxes">
<div id="dialog" class="window">
Simple Modal Window |
<a href="#"class="close"/>Close it</a>
<p>Anything can go Here</p>
</div>
<!-- Mask to cover the whole screen -->
<div id="mask"></div>
</div>
</body>
</html>
这篇关于用于弹出Web屏幕的jQuery Lightbox / Modal Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!