我有一个问题,当我重新加载我的页面,页面从左边开始,但我需要这个中心。我该怎么做?接下来,当它位于中间的时候,它应该向左滚动,直到它的20 it,所以在右边。上下都不重要。2.JPG分辨率为2743宽,768高。
这是我的代码:
css:
* {
margin-left:-90px;
margin-top:-10px;
padding:-60px;
}
body {
background:white;
}
.bg {
background:url("2.JPG");
background-repeat:no-repeat;
height:768px;
width:2743px;
display:block;
}连接^jquery 1-7分钟js
javascript
$(document).ready(function(){
$(this).bind('mousemove',function(e){
$("#bg").css({ "margin-top":e.pageY/100, "margin-left":e.pageX/6 });
});
setTimeout(function() {
$('#top').cycle({
delay: -1500
});
$('.pics img').css({
opacity: 0.5
});
}, 0);
setTimeout(function(){
$('#bottom').cycle({
delay: -3000
});
$('.pics img').css({
opacity: 0.5
});
}, 0);
});这是我的html:
<div class="bg" id="bg"> </div>非常感谢,很抱歉我的英语和我的设计知识:)
发布于 2014-08-13 17:11:21
您可以通过javascript的onmousemove事件轻松地做到这一点。
或者你可以用这个来解决你的问题,我希望它能起作用,http://css-tricks.com/auto-moving-parallax-background/。
https://stackoverflow.com/questions/25292157
复制相似问题