JS實現(xiàn)的簡潔縱向滑動菜單(滑動門)效果
本文實例講述了JS實現(xiàn)的簡潔縱向滑動菜單(滑動門)效果。分享給大家供大家參考,具體如下:
這是一款縱向布局的CSS+JavaScript滑動門代碼,相當(dāng)簡潔的手法來實現(xiàn),如果對顏色不滿意,你可以試著自己修改CSS代碼,這個滑動門將每一個“門”的內(nèi)容存入JS數(shù)組中,這樣可以減少代碼量,但也帶來了一個擴展的問題,擴展性方面有待完善,僅供參考。
運行效果截圖如下:
在線演示地址如下:
http://demo.jb51.net/js/2015/js-simple-zxhd-menu-demo/
具體代碼如下:
<html> <head> <title>縱向滑動門</title> <style> td,a,body{font-size:9pt;} /*--選中的情況下*/ .DivAround_focus{cursor:pointer;background-color:#A1ACDB;border-right:solid 1px #A1ACDB;border-bottom:solid 1px #333333; border-left:solid 1px #C8CEEA; border-top:solid 1px #C8CEEA;color:#000000} /*未選中時邊框顏色*/ .DivAround_blur{cursor:pointer;background:#4D5C9F;border-right:solid 1px #eeeeee;border-bottom:solid 1px #333333; border-left:solid 1px #798ACC; border-top:solid 1px #A1ACDB;color:#FFFFFF} .DivAround_content{background-color:#A1ACDB;border-right:solid 1px #888888;border-bottom:solid 1px #555555; border-left:0px; border-top:solid 1px #C8CEEA;} </style> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <body> <table cellpadding="0" cellspacing="0" border="0" align="center" bgcolor="#6271B1"> <tr><td valign="top"> <table cellpadding="0" cellspacing="0" border="0" width="84" id="leftButtonTAble"> <!--改變下面td 的高來控制整個高度--> <tr><td height="20" align="center" class="DivAround_focus" onMouseOver="ChangeFocus(this)">七星彩</td></tr> <tr><td height="20" align="center" class="DivAround_blur" onMouseOver="ChangeFocus(this)">排列五</td></tr> <tr><td height="20" align="center" class="DivAround_blur" onMouseOver="ChangeFocus(this)">籃球彩</td></tr> <tr><td height="22" align="center" class="DivAround_blur" onMouseOver="ChangeFocus(this)">足球彩</td></tr> </table> </td> <td> <table width="303" border="0" cellpadding="0" cellspacing="0" class="DivAround_content"> <tr> <td valign="top" id="DivAroundContent" height=80><p>dsadsa </p></td> </tr> </table> </td></tr> </table> <script language="javascript">ChangeFocus(document.getElementById("leftButtonTAble").rows[0].cells[0]);</script> </body></html> <script language="javascript"> var AroundInfoArray=new Array(); AroundInfoArray[0]="七星彩"; AroundInfoArray[1]="排列五"; AroundInfoArray[2]="籃球彩"; AroundInfoArray[3]="足球彩"; function ChangeFocus(obj) { for(i=0;i<document.getElementById("leftButtonTAble").rows.length;i++) { if(document.getElementById("leftButtonTAble").rows[i].cells[0]==obj) { document.getElementById("leftButtonTAble").rows[i].cells[0].className="DivAround_focus"; document.getElementById("DivAroundContent").innerHTML=AroundInfoArray[i]; }else{ document.getElementById("leftButtonTAble").rows[i].cells[0].className="DivAround_blur"; } } } </script>
希望本文所述對大家JavaScript程序設(shè)計有所幫助。
相關(guān)文章
JS+CSS實現(xiàn)模仿瀏覽器網(wǎng)頁字符查找功能的方法
這篇文章主要介紹了JS+CSS實現(xiàn)模仿瀏覽器網(wǎng)頁字符查找功能的方法,實例分析了javascript實現(xiàn)查找功能的樣式及相關(guān)技巧,具有一定參考借鑒價值,需要的朋友可以參考下2015-02-02jquery實現(xiàn)文本框textarea自適應(yīng)高度
這篇文章主要介紹了jquery實現(xiàn)文本框textarea自適應(yīng)高度的相關(guān)資料,需要的朋友可以參考下2016-03-03JavaScript實現(xiàn)動態(tài)加載刪除表格
這篇文章主要為大家詳細介紹了JavaScript實現(xiàn)動態(tài)加載刪除表格,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2021-04-04動態(tài)統(tǒng)計當(dāng)前輸入內(nèi)容的字節(jié)、字符數(shù)的實例詳解
這篇文章主要介紹了動態(tài)統(tǒng)計當(dāng)前輸入內(nèi)容的字節(jié)、字符數(shù)的實例詳解的相關(guān)資料,希望通過本文能幫助到大家,讓大家實現(xiàn)這樣的功能,需要的朋友可以參考下2017-10-10js實現(xiàn)鼠標(biāo)滑動到某個div禁止?jié)L動
這篇文章主要為大家詳細介紹了js實現(xiàn)鼠標(biāo)滑動到某個div禁止?jié)L動,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2020-09-09