2013-01-22 268 views
0

這應該像Google地圖標記一樣工作。當你點擊某個元素時,它會平滑地生成標記(座標)。滾動到隱藏元素

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/

回答