1 <!DOCTYPE html> 2 <html lang="en"> 3 <style> 4 </style> 5 <head> 6 <meta charset="UTF-8"> 7 <title>演示文档</title> 8 <script type="text/javascript" src="jquery-1.11.1.min.js"></script> 9 <style type="text/css"> 10 .nav{ 11 width: 100px;height: 300px;border-radius: 0 15px 15px 0;background: #82FCB8;position: absolute; top: 50px;left: -100px; 12 } 13 .nav span{display: block; background: orange;width: 30px;height: 90px;border-radius: 0 4px 4px 0;font-size: 20px;line-height: 30px;position: relative;left: 100px;top:100px;} 14 </style> 15 </head> 16 <body> 17 <div class="nav"> 18 <span>分享到</span> 19 <ul> 20 <li>QQ</li> 21 <li>微信</li> 22 <li>微博</li> 23 <li>......</li> 24 </ul> 25 </div> 34 </body> 35 </html>
JS的jQuery代码 26 <script> 27 $('.nav').mouseenter(function(){ 28 $(this).animate({left:'0px'}) 29 }) 30 $('.nav').mouseleave(function(){ 31 $(this).animate({left:'-100px'}) 32 }) 33 </script>
侧边栏功能实现图片: