2013-04-18 50 views
2

如何在滾動頁面時以及何時點擊首頁時創建圖像模式。 我希望速度箭頭上下移動,而不是在我滾動頁面時放棄。滾動時移動圖像

順便說一句,我使用JQuery的運動

enter image description here

enter image description here

<div class="FirstChildBox"> 
       <div class="imageBox"> 
         <img src="textimage2.jpg" id="imageBoxImg"/> 
        <form> 
          <label class="Image1BoxLabel"><input type="checkbox"/>Image1</label> 
         <label class="Image1BoxLabel"><input type="checkbox"/>Image1</label> 
         <label class="Image1BoxLabel"><input type="checkbox"/>Image1</label>1 
         </form> 
         <a href="#">Enemy1</a> 
       </div> 
       <div class="rateImage"> 
        <div class="arrowupdownrate"> 
         <div class="upArrow" id="upArrow"><img src="up_down.png" /> </div> 
         <div class="rateNumber"><a>112320</a></div> 
         <div class="downArrow" id="downArrow"><img src="red_down.png" /></div> 
        </div> 
       </div> 

    </div> 

回答

0

修復rateImage到最近relative父的右上角。在這種情況下,文件。

.rateImage { 
    position: absolute; 
    top: 10px; 
    right: 10px; 
} 

或者,你可以使用:

.rateImage { 
    position: fixed; 
    top: 10px; 
    right: 10px; 
} 

我喜歡position: absolute;,只是因爲它最終被從長遠來看,更加靈活。在這種情況下真的沒關係。

+0

它沒有阻止它打它只是停留在頂部的最大高度之後 –

0

給位置:固定速率的div

.rateImage { 
position: fixed; 
} 
+0

它沒有停止它達到最大高度後它只停留在頂部 –

+0

像[this](http://jsfiddle.net/anpsmn/BwwuV/12/)? – anpsmn

0

以下內容添加到您的upArrowdownArrow CSS類:

position: fixed