[英]Lightbox opens image in NEW WINDOW rather than inside of a lightbox
我嘗試安裝燈箱、花式盒子和引導程序。 它們都不適合我,我已經鏈接並重新鏈接了所有內容。 此時,我不知道該怎么辦。 它在單獨的窗口中作為 jpeg 打開,或者如果我在任何其他 js 之前添加 js,它會在頁面底部加載,沒有燈箱效果/外觀。
<head>
<title>Home: Central Pacific</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="Central Pacific is a 300,000 square foot Class “A” Industrial Development in the Heart of the San Francisco Bay Area" />
<meta name="keywords" content="Real Estate, Industrial, Development, San Francisco, Bay Area, Union City" />
<!--[if lte IE 8]><script src="css/ie/html5shiv.js"></script><![endif]-->
<script type="text/javascript" src="js/lightbox.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js" charset="utf-8"></script>
<script src="js/jquery.dropotron.min.js"></script>
<script src="js/skel.min.js"></script>
<script src="js/skel-layers.min.js"></script>
<script src="js/init.js"></script>
<script type="text/javascript">
$(function() {
$('#gallery a').lightBox();
});
</script>
<noscript>
<link rel="stylesheet" href="css/skel.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/style-noscript.css" />
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
</noscript>
<!--[if lte IE 8]><link rel="stylesheet" href="css/ie/v8.css" /><![endif]-->
<!--[if lte IE 9]><link rel="stylesheet" href="css/ie/v9.css" /><![endif]-->
</head>
和..(沒有空格)
<div id="gallery"><a href="images/aerial01.jpg" rel="lightbox">See Location Map</a></div>
這是我的網站的保管箱文件夾https://www.dropbox.com/sh/n21lwdnr0mathgi/AACXVNAHBwEcJ9Skl24yjk0Aa
您不應該在<head>
加載jquery,lightbox等。 您應該在</body>
標記關閉之前將其加載到代碼的底部。
您可以在此處看到Bootstrap示例: http : //getbootstrap.com/getting-started/請參閱“基本示例”。
當他們競爭時,我通過刪除dropotron腳本解決了這個問題。 然后,將腳本移至body標簽的底部。 我應該提到我在STILL上方使用的燈箱不起作用,但精美的燈箱卻起作用了。
您的里程可能會有所不同,但如果有大量其他 JS 文件並認為存在沖突(這是最后的措施),請刪除 HTML 並使用 jquery 重新添加它。 至於為什么會這樣,它會刪除所有其他事件偵聽器並阻止它們進行干擾。 至於為什么它不刪除燈箱聽眾我不確定。
let original = $('#gallery').html();
$(item).html(original);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.