2009年4月1日星期三

CSS+JS仿苹果导航栏

文章来自:http://www.upsdihtml.com/skill/skill.asp?skillid=88
推荐一个强人的作品,CSS+JS制作的仿苹果导航条


先把下载和预览的地址贴出来:点击下载 效果预览

我把步骤写下来
在页面头部标签<head></head>中加入下面的代码

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/interface.js"></script>

<link href="style.css" rel="stylesheet" type="text/css" />

<!--[if lt IE 7]>
<style type="text/css">
.dock img { behavior: url(iepngfix.htc) }
</style>
<![endif]–>

第一部分是JavaScript,第二部分是CSS样式表,第三部分是针对IE6.0的PNG的hack 。

不要忘记把下面的代码加入到<body>标签中
<script type="text/javascript">
$(document).ready
(
function()
{
  $(’#dock2′).Fisheye
  ({
   maxWidth: 60,
   items: ‘a’,
   itemsText: ’span’,
   container: ‘.dock-container2′,
   itemWidth: 40,
   proximity: 80,
   alignment : ‘left’,
   valign: ‘bottom’,
   halign : ‘center’
  })
}
);
</script>

把下面的代码加到合适的地方,比如头部或者底部注意:span标签一定要在img标签后面
<a class="dock-item" href="#"><img src="images/home.png" alt="home" /><span>Home</span></a>

浏览器兼容性
我已经在IE 6, IE 7, Opera 9, Firefox 2, Firefox 3 and Safari 2上测试通过。

没有评论:

发表评论