用 CSS 打造一个惟妙惟肖的网页版苹果工具条!

如果你是大苹果的粉丝,你一定会爱上这款由 CSS 打造的苹果工具条(dock menu,效果预览),原文作者原创,原文会手把手教你打造!该工具条使用了 Jquery 这个轻量级 Javascript 类库(很多 AJAX 效果哦)提供的接口,Interface 提供的界面组件和原作者的原创 Icon。  这款 CSS dock menu 是为了用在作者打造的 WordPress 皮肤 iTheme 上的,不用我多说,大家都猜到了吧:一款模仿苹果的 WP 主题。

该皮肤支持 widgets ,侧边栏支持拖拽,适合WordPress 2.0 和 2.1,适合以下浏览器:IE, Firefox, Safari, Opera。

想看原文教程呢,请点击这里,想下载 CSS dock menu呢,这里
Insert code
In between the HTML <head> tag, add the following code

1
2
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/interface.js"></script>
1
 <link href="style.css" rel="stylesheet" type="text/css" />
1
2
3
4
5
 <!--[if lt IE 7]>
<style type="text/css">
.dock img { behavior: url(iepngfix.htc) }
</style>
<![endif]>


The first part is the Javascript, second part is CSS stylesheet, and last part is the PNG hack to display probably in IE 6.
Configuration
Don’t forget to add the following code to anywhere within the <body> tag:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<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>

Add or remove item
To add menu item to the top dock (note: span tag is after the img tag):

1
<a class="dock-item" href="#"><img src="images/home.png" alt="home" /><span>Home</span></a>

To add menu item to the bottom dock (note: span tag is before the img tag):

1
<a class="dock-item2" href="#"><span>Home</span><img src="images/home.png" alt="home" /></a>

链接 | 来源