我使用了colorbox jQuery lightbox作为我的灯箱。但在这一点上,一个人应该点击按钮。我希望每当窗口加载时自动弹出。
我的灯箱代码是
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="../jquery.colorbox.js"></script>
<script>
$(document).ready(function(){
$(".ajax").colorbox();
});
</script>
</head>
<body>
<h2>Other Content Types</h2>
<p><a class='ajax' href="../content/daisy.jpg" title="Homer Defined">Outside HTML (Ajax)</a></p>
</html>现在我想在窗口加载时自动弹出窗口。
发布于 2013-02-09 02:00:54
在最新版本的ColorBox中,您可以使用$.colorbox({inline:true, href:".ajax"});
工作演示:http://jsfiddle.net/34v22/
我还清理了你的代码:
<!doctype html>
<head>
<title>My Automatic ColorBox</title>
<link rel="stylesheet" type="text/css" href="../link/to/jquery.colorbox.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript" src="../jquery.colorbox.js"></script>
<script>$(document).ready(function(){$.colorbox({inline:true, href:".ajax"});});</script>
</head>
<body>
<h2>Other Content Types</h2>
<div class='ajax' style='display:none'><a href="../content/daisy.jpg" title="Homer Defined">Outside HTML (Ajax)</a></div>
</body>发布于 2014-05-07 00:54:12
它起作用了,但我无法点击iframe页面。我在iframe里放了一张表格。
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js">
</script>
<script type="text/javascript" src="js/jquery.colorbox.js"></script>
<script>$(document).ready(function(){$.colorbox({inline:true, href:".ajax"});});
</script>
<script>
(function($){
$(document).ready(function() {
$.colorbox({innerWidth:600,innerHeight:500,html:'<iframe width=600 height=500
src=masson-form.html> </iframe>'});
});
})(jQuery);
</script>发布于 2013-06-19 23:22:17
如果您愿意,可以直接在jQuery调用中添加您的html
(function($){
$(document).ready(function() {
$.colorbox({innerWidth:420,innerHeight:315,html:'<iframe width=420 height=315 src=http://www.youtube.com/embed/eh-0knDpn5g frameborder=0 allowfullscreen></iframe>'});
});
})(jQuery);https://stackoverflow.com/questions/14778561
复制相似问题