全屏链接背景
因此,使得这个简单随机全屏背景图片页面,肩和min.js工作, 我敢肯定还有其他的方法来做到这一点,现在我试着让整个页面,只需重新加载页面的链接,以便我得到另一个随机图像。 我找到了让转子div成为链接,CSS解决方案 - 跨度和隐藏显示的方法,但我当然不知道哪个是合适的,没有运气可以让任何东西工作。任何建议都大加赞赏,全屏链接背景
<html>
<head>
<style>
* { margin: 0; padding: 0; }
html {
background: url(images/rotator.php), url(grey.jpg) no-repeat center center fixed ;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#rotator").click(function(){
window.location.reload(true);});
});
</script>
</head>
<body>
<div id="rotator"></div>
</body>
</html>
好了,所以用jQuery的方式没有运气,我没有做到这一点,
<div style="width:800px;height:800px;position:absolute;top:20px;left:20px;" id="rotator" onclick = "window.location.refresh()"></div>
并不理想,但得到我想要的行为,现在要改变光标让人们知道它的一个链接,
内<div id="rotator">
尝试把<a href="" style='display:block;height:100%;width:100%'></a>
想这也没有运气 – johnsmoke 2012-03-10 23:36:42
错误的代码有一个&代替%,我改变了它。 – epascarello 2012-03-11 13:15:56
使用jQuery:
$("#rotator").click(function(){
window.location.reload(true);
});
它将click()事件添加到id为#rotator的div,实际上使它成为一个巨大的链接。点击的结果是刷新。
您可以轻松更改鼠标光标与CSS:
#rotator {cursor: pointer; }
它添加到CSS'光标:pointer' – rgin 2012-03-12 13:00:21