用 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>

鏈接 | 來源