>本文解释了如何创建一个持久的“ 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中文网其他相关文章!