DIV CSS 佈局教程網

右側彈出導航選單完整代碼:分類選單與滑鼠移入效果
編輯:關於JavaScript     

效果概念

這是一個右側彈出的分類導航選單,滑鼠移入分類時,會顯示對應的細項。

HTML 結構

<div class="my_left_category">
  <h1>分類導航</h1>
  <div class="h2_cat" onmouseover="this.className='h2_cat active_cat'" onmouseout="this.className='h2_cat'">
    <h3><a href="#">企業建站</a></h3>
    <div class="h3_cat">...</div>
  </div>
</div>

CSS 重點

使用背景圖做出標題、箭頭、分隔線與彈出陰影。以下保留主要圖片資源。

.my_left_category h1 {
  background-image: url(https:///keleyi/phtml/rightmenu/top.gif);
  background-repeat: no-repeat;
}
.my_left_category .h2_cat {
  background-image: url(https:///keleyi/phtml/rightmenu/right.gif);
  background-repeat: no-repeat;
}
.my_left_category .h2_cat_1 {
  background-image: url(https:///keleyi/phtml/rightmenu/line.gif);
  background-repeat: no-repeat;
}
.my_left_category .shadow {
  background: url(https:///keleyi/phtml/rightmenu/back.gif) left top;
}
.my_left_category .shadow_border {
  background: url(https:///keleyi/phtml/rightmenu/height.gif) no-repeat 0px 21px;
  background-color: #ffffff;
}
.my_left_category .shadow_border ul li {
  background-image: url(https:///keleyi/phtml/rightmenu/justright.gif);
  background-repeat: no-repeat;
}

互動

onmouseover 會加上 active_cat,讓目前分類顯示子選單;onmouseout 會移除,回到收合狀態。

注意

此類選單適合桌面版大量分類。若用於手機,建議改為可折疊的響應式選單。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved