网站模板中心

您现在的位置:首页>>织梦大学>>辅助文档

学习JQUERY,写的简单下拉菜单!

来源: 编辑:admin 发布时间:2019-11-07热度:49 ℃
HTML代码: [html] view plaincopy !DOCTYPEhtml html head script type = text/javascript src =http://ajax.googleapis.com/ajax/libs /jquery/1.7.2/jquery.min.js / script title sidemenu / title / head body div id = menu div class = m-one span c...

HTML代码:

 

[html] view plaincopy  
  1. >  
  2. <html>  
  3.     <head>  
  4.         <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs  
  5. /jquery/1.7.2/jquery.min.js">script>  
  6.         <title>side menutitle>  
  7.     head>  
  8.     <body>  
  9.         <div id="menu">  
  10.             <div class="m-one">  
  11.                 <span class="m-tit">主菜单01span>  
  12.                 <ul class="m-ul">  
  13.                     <li class="m-li">子菜单11li>  
  14.                     <li class="m-li">子菜单12li>  
  15.                     <li class="m-li">子菜单13li>  
  16.                 ul>  
  17.             div>  
  18.             <div class="m-one">  
  19.                 <span class="m-tit">主菜单02span>  
  20.                 <ul class="m-ul">  
  21.                     <li class="m-li">子菜单21li>  
  22.                     <li class="m-li">子菜单22li>  
  23.                     <li class="m-li">子菜单23li>  
  24.                 ul>  
  25.             div>  
  26.             <div class="m-one">  
  27.                 <span class="m-tit">主菜单03span>  
  28.                 <ul class="m-ul">  
  29.                     <li class="m-li">子菜单31li>  
  30.                     <li class="m-li">子菜单32li>  
  31.                     <li class="m-li">子菜单33li>  
  32.                 ul>  
  33.             div>  
  34.             <div class="m-one">  
  35.                 <span class="m-tit">主菜单04span>  
  36.                 <ul class="m-ul">  
  37.                     <li class="m-li">子菜单41li>  
  38.                     <li class="m-li">子菜单42li>  
  39.                     <li class="m-li">子菜单43li>  
  40.                 ul>  
  41.             div>  
  42.             <div class="m-one">  
  43.                 <span class="m-tit">主菜单05span>  
  44.                 <ul class="m-ul">  
  45.                     <li class="m-li">子菜单51li>  
  46.                     <li class="m-li">子菜单52li>  
  47.                     <li class="m-li">子菜单53li>  
  48.                 ul>  
  49.             div>  
  50.         div>  
  51.     body>  
  52. html>  

CSS代码:

 

 

[css] view plaincopy  
  1. #menu {}  
  2. .m-one {float:left;width:100px;height:40px;line-height:40pxtext-align:centerbackground:#eeeeee;}  
  3. .m-one:hover{background:#dddddd;}  
  4. ul,li {list-style:nonemargin:0;padding:0;}  
  5. .m-ul {background:#dddddddisplay:none;}  
  6. .m-li {font-size:12pxheight:25pxline-height:25px;}  
  7. .m-li:hover {background:#cccccc;}  

 

JQUERY代码:

 

[javascript] view plaincopy  
  1. $(document).ready(function() {  
  2.                 $('.m-one').hover(  
  3.                     function(){$(this).children('.m-ul').slideDown(200);},  
  4.                     function(){$(this).children('.m-ul').slideUp(200);}  
  5.                 );  
  6.             });  

Pbootcms问题解决

请点击在线联系我们【点击咨询解决问题】   如果您有任何Pbootcms问题,我们将免费为您写解决教程!

    PB模板网:承接仿站业务,价格200元起!