蜂巢式導航選單程式碼例項
分享一段程式碼例項,它實現了類似蜂巢式導航選單。
程式碼例項如下:
[HTML] 純文字檢視 複製程式碼<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="author" content="http://www.softwhy.com/" /> <title>螞蟻部落</title> <style type="text/css"> .Ct { width: 1000px; margin: 0 auto; } .ywPart1 { width: 310px; margin: 0 auto; padding: 20px 10px 20px 30px; } /**蜂巢樣式***/ .hex { float: left; margin-left: 2px; margin-bottom: -18px; cursor: pointer; } .hex .hex_top { width: 0; border-bottom: 20px solid #f0f0f0; border-left: 35px solid transparent; border-right: 35px solid transparent; margin-top: -1px\9 \0; margin-top: 0px\0; } .hex .hex_middle { width: 70px; height: 30px; line-height: 30px; background: #f0f0f0; text-align: center; font-family: "宋體"; color: #333333; } .hex .hex_bottom { width: 0; border-top: 20px solid #f0f0f0; border-left: 35px solid transparent; border-right: 35px solid transparent; margin-top: -1px\9 \0; margin-top: 0px\0; } .hex-row { clear: left; } .hex-row.even { margin-left: 38px; } .hex-row.odd { margin-right: 38px; } .hex.hexActive .hex_top { width: 0; border-bottom: 20px solid #86ccac; border-left: 35px solid transparent; border-right: 35px solid transparent; margin-top: -1px\9 \0; margin-top: 0px\0; } .hex.hexActive .hex_middle { width: 70px; height: 30px; line-height: 30px; background: #86ccac; text-align: center; font-family: "宋體"; color: #FFFFFF; } .hex.hexActive .hex_bottom { width: 0; border-top: 20px solid #86ccac; border-left: 35px solid transparent; border-right: 35px solid transparent; margin-top: -1px\9 \0; margin-top: 0px\0; } </style> </head> <body> <div class="Ct"> <div class="ywPart1" id="hexDiv"> <div class="hex hexActive" name="hexBlcok"> <div class="hex_top"></div> <div class="hex_middle">即時通訊</div> <div class="hex_bottom"></div> </div> <div class="hex" name="hexBlcok"> <div class="hex_top"></div> <div class="hex_middle">閱讀</div> <div class="hex_bottom"></div> </div> <div class="hex" name="hexBlcok"> <div class="hex_top"></div> <div class="hex_middle">微博</div> <div class="hex_bottom"></div> </div> <div class="hex" name="hexBlcok"> <div class="hex_top"></div> <div class="hex_middle">導航</div> <div class="hex_bottom"></div> </div> <div class="hex hex-row even" name="hexBlcok"> <div class="hex_top"></div> <div class="hex_middle">視訊</div> <div class="hex_bottom"></div> </div> <div class="hex" name="hexBlcok"> <div class="hex_top"></div> <div class="hex_middle">音樂</div> <div class="hex_bottom"></div> </div> <div class="hex" name="hexBlcok"> <div class="hex_top"></div> <div class="hex_middle">應用商店</div> <div class="hex_bottom"></div> </div> <div class="hex hex-row" name="hexBlcok"> <div class="hex_top"></div> <div class="hex_middle">遊戲</div> <div class="hex_bottom"></div> </div> <div class="hex" name="hexBlcok"> <div class="hex_top"></div> <div class="hex_middle">支付</div> <div class="hex_bottom"></div> </div> <div class="hex" name="hexBlcok"> <div class="hex_top"></div> <div class="hex_middle">動漫</div> <div class="hex_bottom"></div> </div> <div class="hex" name="hexBlcok"> <div class="hex_top"></div> <div class="hex_middle">P2P業務</div> <div class="hex_bottom"></div> </div> <div class="hex hex-row even" name="hexBlcok"> <div class="hex_top"></div> <div class="hex_middle">VOIP業務</div> <div class="hex_bottom"></div> </div> <div class="hex" name="hexBlcok"> <div class="hex_top"></div> <div class="hex_middle">彩信</div> <div class="hex_bottom"></div> </div> <div class="hex" name="hexBlcok"> <div class="hex_top"></div> <div class="hex_middle">瀏覽下載</div> <div class="hex_bottom"></div> </div> <div class="hex hex-row" name="hexBlcok"> <div class="hex_top"></div> <div class="hex_middle">財經</div> <div class="hex_bottom"></div> </div> <div class="hex" name="hexBlcok"> <div class="hex_top"></div> <div class="hex_middle">安全防毒</div> <div class="hex_bottom"></div> </div> <div class="hex" name="hexBlcok"> <div class="hex_top"></div> <div class="hex_middle">郵箱</div> <div class="hex_bottom"></div> </div> <div class="hex" name="hexBlcok"> <div class="hex_top"></div> <div class="hex_middle">其他</div> <div class="hex_bottom"></div> </div> <div class="ClearFloat"></div> </div> </div> <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script> <script> $("#hexDiv").find("div[name='hexBlcok']").on("click",function(){ $(this).addClass("hexActive"); $(this).siblings("div[name='hexBlcok']").removeClass("hexActive"); }); </script> </body> </html>
相關文章
- 響應式導航選單程式碼例項
- css簡單水平導航選單程式碼例項CSS
- javascript樹形導航選單例項程式碼JavaScript單例
- css樹形導航選單程式碼例項CSS
- 自定義右鍵導航選單程式碼例項
- 垂直手風琴導航選單程式碼例項
- 網頁頂部導航選單程式碼例項網頁
- CSS3 扇形導航選單程式碼例項CSSS3
- CSS3立體導航選單程式碼例項CSSS3
- 垂直樹形多級導航選單程式碼例項
- 垂直可伸縮的導航選單例項程式碼單例
- CSS製作橫向導航選單例項程式碼CSS單例
- 側欄能夠定位的導航選單程式碼例項
- 可以固定的頂部的導航選單簡單例項程式碼單例
- js橫向滑動摺疊導航選單程式碼例項JS
- css水平下拉導航選單程式碼例項CSS
- 純CSS實現的二級導航選單效果程式碼例項CSS
- jQuery垂直可摺疊展開導航選單程式碼例項詳解jQuery
- css3實現的立體導航選單效果程式碼例項CSSS3
- css三級下拉導航選單程式碼例項CSS
- 導航欄背景切換程式碼例項
- html 仿百度百科導航下拉選單功能例項程式碼介紹HTML
- 具有淡入淡出效果的下拉導航選單例項程式碼單例
- js選項卡簡單程式碼例項JS
- PbootCMS導航選單-導航選單的使用教程boot
- css自定義單選按鈕的樣式程式碼例項CSS
- 遮蔽滑鼠右鍵選單例項程式碼單例
- css二級下拉選單程式碼例項CSS
- jQuery 省市級聯選單程式碼例項jQuery
- js省市級聯選單程式碼例項JS
- select下拉選單美化程式碼例項
- 禁用文字選擇、右鍵選單例項程式碼單例
- 具有響應式效果的導航選單
- jQuery鏈式呼叫簡單例項程式碼jQuery單例
- select下拉選單項互換效果程式碼例項
- javascript刪除select下拉選單項程式碼例項JavaScript
- 滑鼠懸浮出現下拉選單程式碼例項
- jQuery美化select下拉選單程式碼例項jQuery