小编Sim*_*mon的帖子

将鼠标移到背景图像上(单视差)

当鼠标位于"着陆内容"DIV时,我想让背景图像在X和Y轴上略微移动,它应该随着鼠标的移动而移动.它应该反向移动.例如.鼠标向下移动,"着陆内容"图像向上移动.

HTML

<div id="landing-content">
<section class="slider"> 
<img src="http://i.imgur.com/fVWomWz.png"></img>
</section>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS

#landing-content {
overflow: hidden;
background-image: url(http://i.imgur.com/F2FPRMd.jpg);
width: 100%;
background-size: cover;
background-repeat: no-repeat;
max-height: 500px;
border-bottom: solid;
border-bottom-color: #628027;
border-bottom-width: 5px;
}

.slider {
margin-left: auto;
margin-right: auto;
overflow: hidden;
padding-top: 200px;
max-width: 1002px;
}

.slider img {
width: 80%;
padding-left: 10%;
padding-right: 10%;
height: auto;
margin-left: auto;
margin-right: auto;
}
Run Code Online (Sandbox Code Playgroud)

JSFiddle http://jsfiddle.net/uMk7m/

任何帮助都会得到赞赏.

html jquery html5 css3 parallax

11
推荐指数
2
解决办法
6万
查看次数

标签 统计

css3 ×1

html ×1

html5 ×1

jquery ×1

parallax ×1