Blogger Information
Blog 17
fans 1
comment 1
visits 16546
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
下滑线跟随导航
雷国恩的博客
Original
632 people have browsed it

 <!DOCTYPE html>
<html>
 <head>
  <title>下滑线跟随导航</title>
  <meta charset="utf-8"/>
  <script type="text/javascript" src="jquery-3.3.1.js"></script>
    <style type="text/css">
  *{padding:0;margin:0;}
  ul {list-style: none;z-index:20;position:relative;font-size: 15px;}
  li {float:left;cursor:pointer;width:100px;height: 30px;text-align:center;line-height:30px;color: #fff;font-weight: bold;}
  .menu{width:500px;position:relative;margin:20px auto;height:32px;box-shadow: 0 2px 20px #000;background: #AF3434;border-radius:3px }
  </style>
  <script type="text/javascript">
    $(function(){
      $('li').hover(function(){
         $x=parseInt($(this).attr('name'))*100;
         $('.block').stop().animate({left:$x+'px'},100);
      },function(){
        $('.block').stop().animate({left:'0px'},100);
      }

      )
    })
  </script>
 </head>
 <body>
   <div class="menu">
   <ul>
     <li name="0">首页</li>
     <li name="1">php中文网</li>
     <li name="2">独孤九剑</li>
     <li name="3">西门大官人</li>
     <li name="4">灭绝师太</li>
   </ul>
  <div class="block" style="z-index:10;width:100px;height:2px;background:#fff;position:absolute;top:30px;"></div>

 </div>
 
 </body>
</html>

Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post