这应该像谷歌地图标记一样工作。当您单击某个元素时,它将平滑地动画到标记(坐标)。
HTML:
<div id="wrapper">
<div id="inner">
<div id="marker"><!-- --></div>
</div>
</div>
<div class="overflow">Hover to disable overflow</div>
CSS:
#wrapper {
width: 300px;
height: 300px;
border: 3px solid #999;
position: relative;
overflow: hidden;
margin: 50px auto 0;
z-index: 1;
}
#inner {
width: 600px;
height: 600px;
background: url("http://i50.tinypic.com/25aq6iu.jpg") no-repeat 0 0 #fff;
position: absolute;
top: -150px;
left: -200px;
}
#marker {
width: 20px;
height: 26px;
background: url("http://i50.tinypic.com/29kujo3.png") no-repeat 0 0 transparent;
position: absolute;
top: 123px;
left: 153px;
}
.overflow {
display: inline-block;
background-color: #ccc;
margin: 20px auto 0;
padding: 10px;
position: fixed;
left: 0;
bottom: 0;
z-index: 9999;
}
如何让它发挥作用?
这是小提琴:http: //jsfiddle.net/xRbR8/1/