2012-05-11 24 views
0

我需要你的幫助。鏈接到同一頁上的位置不匹配

我做了一個導航欄,鏈接到錨點位置在同一頁面上,允許查看端口向下滾動時單擊(沒有什麼複雜的)。

問題:在使用網頁過渡並縮小高度爲0的頂部有一個很大的封面頁。導航鏈接認爲有一個大頁面並向下滾動太多。

有沒有人有解決方案?也許Jquery檢測scrollTop()並使用if語句來調整/偏移()的位置?

這裏是鏈接:[www.imbenton.com] [1]

代碼:

----------- CSS ------ ----

#cover img{ 
    max-width: 90%; 
    padding: 300px 0 600px 0; 
    margin: 0 auto; 
    -webkit-transition: all 0.8s ease-out; 
    -moz-transition: all 0.8s ease-out; 
     -ms-transition: all 0.8s ease-out; 
     -o-transition: all 0.8s ease-out; 
      transition: all 0.8s ease-out; 
} 


#cover img.alt{ 
background: url("dvsup.png") repeat fixed; 
    max-width: 0%; 
    padding: 100px 0; 
    margin: 0 auto; 
} 

nav { 
    position: fixed; 
    width: 100%; 
    top: 173px; 
    padding: 0px 0 5px 0; 
    text-align: center; 
    height: auto; 
    -webkit-transition: all 0.8s ease-out; 
    -moz-transition: all 0.8s ease-out; 
    -ms-transition: all 0.8s ease-out; 
    -o-transition: all 0.8s ease-out; 
    transition: all 0.8s ease-out; 
    z-index: 999; 

} 
nav.still{ 
    position: fixed; 
    top: -980px; 
    padding-top: 900px; 
    background: url("dvsup.png") repeat fixed; 

} 

回答

0

頁面有點酷,但也是一種不好的體驗。你可以發佈一些代碼,瞭解它是如何工作的?

你總是可以有封面頁的頂部這樣的覆蓋面高度應正確計算,或者如果你知道這是越來越失算了,你可以隨時調整滾動y位置的高度差

更新:

我有一個未經測試的想法,使用jQuery將填充或邊距放到內容的頂部(而不是封面)。這個空間應該等於封面的高度。這可能會糾正計算,您將不得不對其進行測試。你還可以發佈一些HTML?除非鏈接只是內部鏈接,那麼不要擔心html

+0

謝謝。不好的經歷啊......我怎麼能讓它變得更好? quickleft.com有一個類似的橫幅。如果我做一個覆蓋,經驗更糟糕,因爲它隱藏了重要的內容。 –

+0

好,如果你的網頁是華而不實,然後離開,只是試圖修復高度的事情。我將不得不花一些時間來看代碼 – Huangism

相關問題