全屏链接背景

时间:2012-03-10 20:28:23

标签: jquery background webkit fullscreen rotator

所以,制作这个简单的随机全屏bg图片页面,rotator和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> 

不理想,但得到我想要的行为,现在改变光标让人们知道它的链接,

2 个答案:

答案 0 :(得分:0)

<div id="rotator">内{p>尝试<a href="" style='display:block;height:100%;width:100%'></a>

答案 1 :(得分:0)

使用jQuery:

$("#rotator").click(function(){
    window.location.reload(true);
});

它将一个click()事件添加到id为#rotator的div中,有效地使它成为一个巨大的链接。点击的结果是刷新。

您可以使用CSS轻松更改鼠标光标:

#rotator {cursor: pointer; }