我开始用 Metro UI 制作一个小网站来教育自己。
当我用鼠标悬停在它上面时,我想制作一张显示一些信息的图片,一旦按下它就会弹出一个对话框。
但不知何故,关闭按钮没有做任何事情。
关闭按钮不执行任何操作。单击对话框本身或磁贴会再次关闭对话框,但单击 X 不会执行任何操作。
我想要关闭按钮来完成他的目的,如果我点击它就关闭对话框。
这是我的代码,希望你能帮助我。
<!DOCTYPE html>
<html lang="de">
<html>
<head>
<link href="build/css/metro.css" rel="stylesheet">
<link href="build/css/metro-icons.css" rel="stylesheet">
<script src="build/js/jquery.js" > </script>
<script src="build/js/metro.js" > </script>
<meta charset="utf-8"/>
</head>
<body bgcolor="#4da6ff">
<div class="app-bar">
<span class="app-bar-divider"> </span>
<ul class="app-bar-menu">
<li> <a href="index.html">Startseite</a> </li>
<li> <a href="" class="dropdown-toggle">Unterkünfte</a>
<ul class="d-menu" data-role="dropdown">
<li> <a href="Austatttung.html">Die Austattung</a> </li>
<li> <a href="Service.html">Unser Service</a> </li>
<li> <a href="Preise.html">Preise</a> </li>
</ul>
</li>
<li> <a href="" class="dropdown-toggle">Bildergalerie</a>
<ul class="d-menu" data-role="dropdown">
<li>
<a href="Wohnungen.html">
<span class="mif-file-picture"> Ferienwohnungen
</span>
</a>
</li>
<li>
<a href="Brandenburg.html">
<span class="mif-file-picture"> Brandenburg a.d.H
</span>
</a>
</li>
</ul>
</li>
<li> <a href="Reservierung.html">Reservierungsanfrage</a></li>
<li> <a href="Anfahrt.html">Anfahrt</a>
<span class="mif-automobile mif-1x"> </span>
</li>
<li> <a href="Kontakt.html">Kontakt</a></li>
<li> <a href="Impressum.html">Impressum</a><li>
</ul>
</div>
<div class="tile-big">
<div class="tile-content" onclick="toggleMetroDialog('#dialog')">
<div class="image-container">
<div class="frame" >
<img src="bilder/fox.jpg">
<div data-role="dialog" id="dialog" class="padding20" data-close-button="true">
<h1>Ahihahihahi Ahihahihahi Ahihahihahi!</h1>
</div>
</div>
<div class="image-overlay">
<b>What does the fox say ?</b>
</div>
</div>
</div>
</div>
<div class="tile-big">
<div class="tile-content">
<img src="bilder/badhbruecke.jpg" data-role="fit-image" data-format="accurate">
</div>
</div>
<script>
function showDialog(id)
{
var dialog = $(id).data('dialog');
if (!dialog.element.data('opened'))
{
dialog.open();
}
else
{
dialog.close();
}
}
</script>
</body>
</html>