我正在使用MetroJS为我的网站制作metro tiles,然而我对网站上缺乏文档感到恼火。有没有人能帮我拿到这个可点击的磁贴?不管我用哪种方法,它都不起作用。它使用锚点作为链接,但这意味着我不能使用退回功能。到目前为止,我的代码如下:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/cdn/metrojs/MetroJs.min.css">
<script type="text/javascript" src="/cdn/metrojs/MetroJs.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>
<body>
<div id="live-tile" class="live-tile" data-mode="none" data-bounce="true" data-link="http://google.com/">
<img src="/cdn/metro-icons/Web%20Browsers/Internet%20Explorer.png" class="live-tile full">
</div>
<script type="text/javascript">
$(".live-tile").liveTile({
click: function ($tile, tileData) {
var id = $tile.attr("id");
window.location = "postpage.php?name=" + id;
return false; // or return true;
}
});
</script>
</body>
</html>有人能帮我吗,这本来是很简单的,为什么我不能只使用一个标准的锚,而不是这种jQuery的废话?
发布于 2014-04-06 22:08:20
您可以在活动磁贴中使用标准锚点标记,而不会出现任何问题。如果您将完整的类添加到其中,则默认情况下,它将占用磁贴。如果您将其嵌套在div中,它将呈现其父级的强调色。数据链路只是一个帮手,它远不如锚链可取。
<div id="live-tile" class="live-tile" data-mode="none" data-bounce="true">
<a href="http://google.com/" class="full">
<img src="/cdn/metro-icons/Web%20Browsers/Internet%20Explorer.png" class="full">
</a>
</div>也可以通过以下方式绑定click
$(".live-tile").liveTile().on("click", function(e){ /* do stuff */ });https://stackoverflow.com/questions/22212850
复制相似问题