本文實例講述了jquery實現(xiàn)頂部向右伸縮的導(dǎo)航區(qū)域代碼。分享給大家供大家參考。具體如下:
這是一款類似導(dǎo)航的菜單,但擴(kuò)展性比較強(qiáng),不但可以用作菜單,更可以用作導(dǎo)航塊效果,導(dǎo)航塊內(nèi)可以含有菜單或者是其它的一些功能,本效果基于jQuery實現(xiàn),用鼠標(biāo)點擊浮動層左端的箭頭,即可合攏與伸開此菜單。
運行效果截圖如下:

在線演示地址如下:
http://demo.VeVB.COm/js/2015/jquery-right-hidden-show-nav-style-codes/
具體代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>鼠標(biāo)單擊控制收縮和展開的窗口</title><meta http-equiv="content-type" content="text/html;charset=gb2312"><style type="text/css">*{margin:0;padding:0;}#box{position:absolute;right:0;top:0;overflow:hidden;}#arrow{color:#fff;background:#000;width:20px;height:90px;line-height:90px;font-size:12px;font-family:"宋體";text-align:center;font-weight:bold;float:left;}#col_box{width:400px;height:90px;background:#eee;float:left;}</style><script type="text/javascript" src="jquery-1.6.2.min.js"></script><script type="text/javascript">$(document).ready(function() { var oMoveBox = $("#col_box"), oArr = $("#arrow"), maxL = 400; oArr.click(function(){ oMoveBox.animate({"width":"-="+maxL},600,function(){ maxL = -maxL; $("#arrow").html(maxL<0 ? "<" : ">"); }) });});</script></head><body><div id="box"> <div id="arrow">></div> <div id="col_box">z<br>z<br>s<br>k<br>y</div></div></body></html>希望本文所述對大家的jquery程序設(shè)計有所幫助。
新聞熱點
疑難解答