[英]Fancybox iframe openning only first link
I am a layman in html, but for my personal website, I am trying to add some lightbox (Fancybox). 我是html的外行,但对于我的个人网站,我正在尝试添加一些灯箱(Fancybox)。
The problem I am facing is that it is only opening the first link as the lightbox, not the 2nd one. 我面临的问题是它只打开第一个链接作为灯箱,而不是第二个链接。 If I interchange the position (ie the 2nd link which was not opening became 1st) then the present first link is opening, and not the previous one.
如果我交换位置(即未打开的第二个链接变为第一个),则当前第一个链接打开,而不是前一个链接。 I have tried to make an minimal example:
我试图做一个最小的例子:
index.html: index.html的:
<!DOCTYPE html>
<head>
<title>Learning Fancybox</title>
<script>
!window.jQuery && document.write('<script src="jquery-1.4.3.min.js"><\/script>');
</script>
<script type="text/javascript" src="./fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="./fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<script type="text/javascript">
$(document).ready(function() {
$("#iframe").fancybox({
'width' : '75%',
'height' : '75%',
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe'
});
});
</script>
</head>
<body>
<div id="content">
<table cellpadding="10" cellspacing="0" border="0">
<tr>
<td>
<h3>Trying Fancybox</h3>
<li><a id="iframe" href="jbn.html" />content1</a></li>
<li><a id="iframe" href="chabi.html" />content2</a></li>
</td>
</tr>
</table>
</div>
</body>
</html>
content1(jbn.html) 内容1(jbn.html)
<!DOCTYPE html>
<head>
<title>content2</title>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8"/>
</head>
<body>
<div id="container">
<div id="header">
<div id="content">
Some txt for content2
</div>
</div>
</div>
</body>
</html>
and content 2(chabi.html) 和内容2(chabi.html)
<!DOCTYPE html>
<head>
<title>lb content1</title>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8"/>
</head>
<body>
<div id="container">
<div id="header">
<div id="content">
Some txt here
</div>
</div>
</div>
</body>
</html>
As it is now, the jbn.html is opening as lightbox, chabi.html is opening as an independent webpage. 就像现在一样,jbn.html作为灯箱开放,chabi.html作为独立网页开放。
Please help 请帮忙
UPDATE It is possibly not a fancybox problem, as I have just checked, if I add an identical id as #iframe2
and change the id of the 2nd links id to that, it is working properly. 更新它可能不是一个fancybox问题,因为我刚刚检查过,如果我添加一个相同的id作为
#iframe2
并将第二个链接id的id更改为,它正常工作。 Please help. 请帮忙。
通过将id更改为类(.iframe)来解决问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.