>本文解釋瞭如何創建一個持久的“ catfish”廣告橫幅,即使在滾動時,該橫幅仍在網頁的底部仍然可見。 該技術結合了CSS和JavaScript,以及用於Internet Explorer的特殊處理。
密鑰概念:
position: fixed
position: fixed
div#zip
position: absolute
> ie特定的處理:overflow: auto
)動態地將包裝器div注入IE DOM中,確保兼容性而不會影響其他瀏覽器。
wrapFish
有效的標記:>
:
: catfish.css
#catfish { position: fixed; bottom: 0; background: transparent url(images/catfish-tile.gif) repeat-x left bottom; padding: 0; height: 79px; /* includes transparent part */ cursor: pointer; margin: 0; width: 100%; } html { padding: 0 0 58px 0; /* 58px = height of the opaque part of the Catfish */ }
: IEhack.css
div#zip { width: 100%; padding: 0; margin: 0; height: 100%; overflow: auto; position: relative; }
catfish.js
這種方法可確保跨瀏覽器的一致用戶體驗,同時最大程度地減少不必要的代碼。 進一步的改進,例如有條件的橫幅選擇和放置控制,將增強功能。
以上是cat魚 - 第1部分的詳細內容。更多資訊請關注PHP中文網其他相關文章!