-6
A
回答
2
看到link
的答案,我準備在回答一個演示可能它幫助你
你需要主要的是jQuery的
$(function(){ // this is the shorthand for document.ready
$(document).scroll(function(){ // this is the scroll event for the document
scrolltop = $(document).scrollTop(); // by this we get the value of the scrolltop ie how much scroll has been don by user
if(parseInt(scrolltop) >= 80) // check if the scroll value is equal to the top of navigation
{
$("#navbar").css({"position":"fixed","top":"0"}); // is yes then make the position fixed to top 0
}
else
{
$("#navbar").css({"position":"absolute","top":"80px"}); // if no then make the position to absolute and set it to 80
}
})
});
+0
還注意位置:對未來粘性。 http://updates.html5rocks.com/2012/08/Stick-your-landings-position-sticky-lands-in-WebKit – urbananimal
+0
感謝兄弟這是我需要的:) –
+0
該腳本不爲我在IE中工作,任何解? –
相關問題
- 1. 適用於所有瀏覽器的標準css修復程序?
- 2. 修復CSS下拉菜單
- 3. 修復css圖像菜單
- 4. IE8 CSS菜單修復
- 5. 根據瀏覽器
- 6. 跨瀏覽器CSS複選框問題
- 7. TinyMCE的瀏覽器「修復」
- 8. CSS圖像/文本菜單跨瀏覽器問題
- 9. CSS菜單具有跨瀏覽器的問題
- 10. 根據瀏覽器Cookie更改Wordpress菜單
- 11. 標題菜單CSS問題
- 12. 調整瀏覽器和菜單欄的隱藏標題內容
- 13. 在Chrome瀏覽器右鍵菜單標題
- 14. CSS跨瀏覽器問題
- 15. 跨瀏覽器CSS問題
- 16. CSS修復了重複背景問題
- 17. 瀏覽器兼容的asp菜單css不工作在谷歌瀏覽器
- 18. 字體(根據瀏覽器)
- 19. 瀏覽器忽略了CSS選擇器?
- 20. css引導滑塊菜單修復
- 21. 如何修復CSS子菜單
- 22. WordPress的菜單修復(CSS或JavaScript)
- 23. 使用CSS或Javascript修復頁腳底部10%的瀏覽器?
- 24. 需要幫助修復在IE瀏覽器的css
- 25. 尋找一個IE瀏覽器的CSS修復程序
- 26. css修復鉻和其他網絡瀏覽器
- 27. 使用background-attachment:修復了ipad上的Safari瀏覽器
- 28. 根據瀏覽器更改網頁字體類型根據瀏覽器
- 29. Web瀏覽器標題
- 30. HTML/CSS:除了谷歌瀏覽器
你能解釋一下你需要一點點更清楚地描述你已經嘗試過的東西? –
請讓我們知道您已經嘗試過,並且我們可以幫助您更好。 – karthikr
只要看看他們的代碼。我在一分鐘之內發現它。 –