2016-09-28 21 views

回答

0

嘗試類似this。基本上,每當頁面滾動時,這將檢查你在頁面中的位置,並且可以基於該頁面進行切換。我建議一旦你到達屏幕上的那一點做一個(你想要修復的元素).addClass()

0

你可以這樣做。引用工作演示。

<!DOCTYPE html> 
 
<html> 
 
<head> 
 
\t <title></title> 
 
\t <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> 
 
\t 
 
</head> 
 

 
<style type="text/css"> 
 
.left{ 
 
    width: 200px; 
 
    height: 200px; 
 
    background-color: orange; 
 
    position: fixed; 
 
    left: 0; 
 
    top: 0; 
 

 
} 
 

 
.right{ 
 
    width: 400px; 
 
    height: 1500px; 
 
    background-color: gray; 
 
    position: absolute; 
 
    right: 0; 
 
    top: 0; 
 

 
} 
 

 
.right h1{ 
 
    position: absolute; 
 
    bottom: 0; 
 
} 
 

 

 
</style> 
 

 

 
<body> 
 

 
<div class="left">I am the left div</div> 
 
<div class="right">I am the right div 
 

 
<h1>bottom</h1> 
 
</div> 
 

 

 

 
<script type="text/javascript"> 
 

 

 
</script> 
 

 

 

 

 
</body> 
 

 

 
</html>

+0

謝謝,但我的左div有內容,所以它需要滾動,直到最後 –

+0

更改您的左div高度作爲您的需要 –

+0

我舉了一個網站的例子來看看它 –