我想使用lightbox打開一個窗體,窗體本身是另一個頁面中使用的html。燈箱開放html
問題是我試過ShadowBox,它打開一個iframe,我的大部分變量在這個過程中都丟失了。我試過Lightbox5
,我似乎無法找到代碼傳入一個HTML。
有什麼建議嗎?
我做了這樣的事情與太極拳
<a rel="shadowbox[MyStuff]" href="survey.html">survey</a>
它將解析了在元素傳遞是一個HTML,但它會在iframe打開從而失去了變數,我有這個頁面
加入整個樣本代碼
<html>
<head>
<!-- the shadowbox stylesheet and js -->
<link rel="stylesheet" type="text/css" href="jquery.lightbox-0.5.css"
media="screen" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.lightbox-0.5.js"></script>
<script type="text/javascript">
$(document)
.ready(function()
{
// Use this example, or...
$('a[@rel*=lightbox]')
.lightBox(); // Select all links that contains lightbox in the attribute rel
// This, or...
$('#gallery a')
.lightBox(); // Select all links in object with gallery ID
$('#somehiddendiv div')
.lightBox(); // Select all links in object with gallery ID
// This, or...
$('a.lightbox')
.lightBox(); // Select all links with lightbox class
// This, or...
$('a')
.lightBox(); // Select all links in the page
// ... The possibility are many. Use your creative or choose one in the examples above
});
$(function()
{
$.ajax(
{
url: 'survey.html',
dataType: 'html',
success: function (data)
{
$('#somehiddendiv')
.html(data);
}
});
});
</script>
</head>
<body>
<!-- <a href="egypt.jpg"><img src="download.jpg" width="72" height="72" alt="" /></a>
-->
<div id="somehiddendiv"></div>
</body>
使用ajax調用獲取其他頁面並在正確的事件中填充燈箱? – Johan
對不起,我不太明白你在說什麼。 – jonleech
新增示例 – Johan