来自 系统操作 2019-09-04 19:47 的文章
当前位置: 六合联盟网 > 系统操作 > 正文

jquery实现可横向和竖向展开的动态下滑菜单功用

本文实例陈述了jquery完成可横向和竖向展开的动态下滑菜单功效。分享给大家供我们仿照效法。具体如下:

本文实例陈诉了jquery实现革命竖向多级向右张开的领航菜单成效。分享给大家供我们参谋。具体如下:

此间演示了四个下拉领航菜单的效果,用jquery.easing.1.3.js和jquery.naviDropDown.1.0.js以及jquery.hoverIntent.minified.js共同落到实处,最新的jquery版本也足以引进,在示范页面中,分别有横向水平向下滑出的下拉菜单,还应该有纵向垂直布局向右滑出的领航菜单,遵照你的内需选拔选取。

此间介绍的是一款铁黑竖向多级向右打开的导航菜单,多用于博客网址的领航菜单,湖蓝风格,很赏心悦目,向右伸展的美食做法。

运行作效果果截图如下:

运行效果截图如下:

图片 1

图片 2

图片 3

在线演示地址如下:

在线演示地址如下:

切实代码如下:

具体代码如下:

<!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>红色竖向多级向右展开的导航菜单</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<style type="text/css">
.nav{float:left;position:relative;width:253px;}
h2,ul,p{margin:0;padding:0;text-align:center;}
h2{font-weight:400;font-size:100%;background:#9B203F;border-bottom:solid 1px #500C1B;}
h2 a{list-style-type:none;height:37px;color:#fff;line-height:37px;}
ul{font-size:0;background:#9B203F;padding:0 0 40px;}
ul li{list-style-type:none;padding-bottom:5px;color:#fff;font-size:14px;padding:0 20px;height:34px;line-height:34px;position:relative;}
ul li a{border-bottom:dashed 1px #E67A92;display:block;width:196px;margin:0 auto;}
ul li.hover_bg{background:#C30431;}
.Secon_Dary{width:253px;background:#C30431;position:absolute;right:-253px;top:0;padding-bottom:30px;display:none;}
.Secon_Dary p{padding:0 20px;}
.Secon_Dary a{display:block;height:34px;line-height:34px;color:#fff;border-bottom:dashed 1px #E67A92;}
a{cursor:pointer;}
</style>
<script src="jquery-1.6.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
 $(".nav ul li").hover(function(){
  $(this).addClass("hover_bg");
  $(this).children("div").show();
 },function(){
  $(this).removeClass("hover_bg");
  $(this).children("div").hide();
 })
})
</script>
</head>
<body>
<div class="nav">
 <h2><a>ALL CATEGORIES</a></h2>
 <ul>
  <li>
   <a>Posojg</a>
   <div class="Secon_Dary">
    <p>
     <a>AAAAAAAAAAA</a>
     <a>BBBBBB</a>
     <a>AAAAAAAAAAA</a>
     <a>BBBBBB</a>
     <a>AAAAAAAAAAA</a>
     <a>BBBBBB</a>
     <a>AAAAAAAAAAA</a>
     <a>BBBBBB</a>
    </p>
   </div>
  </li>
  <li>
   <a>FOwojg</a>
   <div class="Secon_Dary">
    <p>
     <a>AAAAAAAAAAA</a>
     <a>BBBBBB</a>
     <a>AAAAAAAAAAA</a>
     <a>BBBBBB</a>
     <a>AAAAAAAAAAA</a>
     <a>BBBBBB</a>
     <a>AAAAAAAAAAA</a>
     <a>BBBBBB</a>
    </p>
   </div>  
  </li>
  <li>
   <a>Sowgjed</a>
   <div class="Secon_Dary">
    <p>
     <a>AAAAAAAAAAA</a>
     <a>BBBBBB</a>
     <a>AAAAAAAAAAA</a>
     <a>BBBBBB</a>
     <a>AAAAAAAAAAA</a>
     <a>BBBBBB</a>
     <a>AAAAAAAAAAA</a>
     <a>BBBBBB</a>
    </p>
   </div>
  </li>
  <li>
   <a>Gowjgeo</a>
   <div class="Secon_Dary">
    <p>
     <a>AAAAAAAAAAA</a>
     <a>BBBBBB</a>
     <a>AAAAAAAAAAA</a>
     <a>BBBBBB</a>
     <a>AAAAAAAAAAA</a>
     <a>BBBBBB</a>
     <a>AAAAAAAAAAA</a>
     <a>BBBBBB</a>
    </p>
   </div>
  </li>
 </ul>
</div>
</body>
</html>
<!DOCTYPE html>
<head>
<title>jQuery纵向横向动态下拉导航菜单</title>
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="js/jquery.hoverIntent.minified.js"></script>
<script type="text/javascript">
//jquery.naviDropDown.1.0.js
(function($){
 $.fn.naviDropDown = function(options) { 
 var defaults = { 
  dropDownClass: 'dropdown',
  dropDownWidth: 'auto',
  slideDownEasing: 'easeInOutCirc',
  slideUpEasing: 'easeInOutCirc',
  slideDownDuration: 500,
  slideUpDuration: 500,
  orientation: 'horizontal'
 }; 
 var opts = $.extend({}, defaults, options);  
 return this.each(function() { 
  var $this = $(this);
  $this.find('.'+opts.dropDownClass).css('width', opts.dropDownWidth).css('display', 'none');
  var buttonWidth = $this.find('.'+opts.dropDownClass).parent().width() + 'px';
  var buttonHeight = $this.find('.'+opts.dropDownClass).parent().height() + 'px';
  if(opts.orientation == 'horizontal') {
  $this.find('.'+opts.dropDownClass).css('left', '0px').css('top', buttonHeight);
  }
  if(opts.orientation == 'vertical') {
  $this.find('.'+opts.dropDownClass).css('left', buttonWidth).css('top', '0px');
  }
  $this.find('li').hoverIntent(getDropDown, hideDropDown);
 });
 function getDropDown(){
  activeNav = $(this);
  showDropDown();
 }
 function showDropDown(){
  activeNav.find('.'+opts.dropDownClass).slideDown({duration:opts.slideDownDuration, easing:opts.slideDownEasing});
 }
 function hideDropDown(){
  activeNav.find('.'+opts.dropDownClass).slideUp({duration:opts.slideUpDuration, easing:opts.slideUpEasing});//hides the current dropdown
 }
 };
})(jQuery);
</script>
<script type="text/javascript">
$(function(){
 $('#navigation_horiz').naviDropDown({
  dropDownWidth: '300px'
 });
 $('#navigation_vert').naviDropDown({
  dropDownWidth: '300px',
  orientation: 'vertical'
 });
});
</script>
<style type="text/css">
* {margin:0; padding:0; font-family:Arial, Helvetica, sans-serif; font-size:11px; font-weight:bold; line-height:16px}
.container {margin:10px auto; width:950px; height:300px; background:#eee; padding:50px 0 0 0} 
#navigation_horiz {width:820px; clear:both; padding:0 0 0 0; margin:0 auto}
#navigation_horiz ul {height:50px; display:block}
#navigation_horiz ul li {display:block; float:left; width:200px; height:50px; background:#999; margin:0 1px 0 0; position:relative}
#navigation_horiz ul li a.navlink {display:block; width:200px; height:30px; padding: 20px 0 0 0; text-align:center; color:#fff; text-decoration:none}
#navigation_horiz .dropdown {position:absolute; padding:20px; border-bottom-right-radius:10px; border-bottom-left-radius:10px; -moz-border-radius-bottomright:10px; -moz-border-radius-bottomleft:10px}
#navigation_vert {width:820px; clear:both; padding:0 0 0 0; margin:0 auto}
#navigation_vert ul {height:50px; display:block}
#navigation_vert ul li {display:block; width:200px; height:50px; background:#999; margin:0 0 1px 0; position:relative}
#navigation_vert ul li a.navlink {display:block; *display:inline-block; width:200px; height:30px; padding: 20px 0 0 0; text-align:center; color:#fff; text-decoration:none}
#navigation_vert .dropdown {position:absolute; padding:20px; border-bottom-right-radius:10px; border-top-right-radius:10px; -moz-border-radius-bottomright:10px; -moz-border-radius-topright:10px}
#navigation_horiz ul li #dropdown_one {background:#ccc; color:#fff}
#navigation_horiz ul li #dropdown_one a {color:red}
#navigation_horiz ul li #dropdown_two {background:#ccc; color:#fff}
#navigation_horiz ul li #dropdown_two a {color:black}
#navigation_horiz ul li #dropdown_three {background:#ccc; color:#fff} 
#navigation_horiz ul li #dropdown_three a {color:gray}
#navigation_vert ul li #dropdown_four {background:#333; color:#fff}
#navigation_vert ul li #dropdown_four a {color:red}
#navigation_vert ul li #dropdown_five {background:#666; color:#fff}
#navigation_vert ul li #dropdown_five a {color:black}
#navigation_vert ul li #dropdown_six {background:#777; color:#fff} 
#navigation_vert ul li #dropdown_six a {color:orange}
</style>
</head>
<body>
 <div class="container">
  <div id="navigation_horiz">
  <ul>
   <li>
    <a href="" class="navlink">List Item</a>
   <div class="dropdown" id="dropdown_one">  
    <p><a href="#">This is a Link</a></p>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin blandit sodales justo, id fringilla eros dapibus vitae. Morbi molestie enim diam, a vulputate neque. Morbi sit amet nunc id quam mollis aliquet. Donec sed massa justo, ut congue enim. Praesent lobortis viverra dolor commodo euismod. </p>
   </div><!-- .dropdown_menu --> 
   </li>
   <li>
    <a href="" class="navlink">List Item</a>
   <div class="dropdown" id="dropdown_two">  
    <p><a href="#">This is a Link</a></p>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin blandit sodales justo, id fringilla eros dapibus vitae. Morbi molestie enim diam, a vulputate neque. Morbi sit amet nunc id quam mollis aliquet. Donec sed massa justo, ut congue enim. Praesent lobortis viverra dolor commodo euismod. </p>
   </div><!-- .dropdown_menu --> 
   </li>
   <li><a href="" class="navlink">List Item</a></li>
   <li>
    <a href="" class="navlink">List Item</a>
   <div class="dropdown" id="dropdown_three">  
    <p><a href="#">This is a Link</a></p>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin blandit sodales justo, id fringilla eros dapibus vitae. Morbi molestie enim diam, a vulputate neque. Morbi sit amet nunc id quam mollis aliquet. Donec sed massa justo, ut congue enim. Praesent lobortis viverra dolor commodo euismod. </p>
   </div><!-- .dropdown_menu -->  
   </li>
  </ul>
  </div><!-- #navigation_horiz -->
 </div><!-- .container -->
 <div class="container">
  <div id="navigation_vert">
  <ul>
   <li>
    <a href="" class="navlink">List Item</a>
   <div class="dropdown" id="dropdown_four">  
    <p><a href="#">This is a Link</a></p>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin blandit sodales justo, id fringilla eros dapibus vitae. Morbi molestie enim diam, a vulputate neque. Morbi sit amet nunc id quam mollis aliquet. Donec sed massa justo, ut congue enim. Praesent lobortis viverra dolor commodo euismod. </p>
   </div><!-- .dropdown_menu --> 
   </li>
   <li>
    <a href="" class="navlink">List Item</a>
   <div class="dropdown" id="dropdown_five">  
    <p><a href="#">This is a Link</a></p>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin blandit sodales justo, id fringilla eros dapibus vitae. Morbi molestie enim diam, a vulputate neque. Morbi sit amet nunc id quam mollis aliquet. Donec sed massa justo, ut congue enim. Praesent lobortis viverra dolor commodo euismod. </p>
   </div><!-- .dropdown_menu --> 
   </li>
   <li><a href="" class="navlink">List Item</a></li>
   <li>
    <a href="" class="navlink">List Item</a>
   <div class="dropdown" id="dropdown_six">  
    <p><a href="#">This is a Link</a></p>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin blandit sodales justo, id fringilla eros dapibus vitae. Morbi molestie enim diam, a vulputate neque. Morbi sit amet nunc id quam mollis aliquet. Donec sed massa justo, ut congue enim. Praesent lobortis viverra dolor commodo euismod. </p>
   </div><!-- .dropdown_menu -->  
   </li>
  </ul>
  </div><!-- #navigation_vert -->
 </div><!-- .container -->
</body>
</html>

期望本文所述对大家的jquery程序设计有着补助。

瞩望本文所述对大家的jquery程序设计有着支持。

你只怕感兴趣的稿子:

  • 依靠jQuery完结以手风琴形式开展和折叠导航菜单
  • jQuery实现折叠、张开的美食指南组效果代码
  • jquery达成可点击伸缩与扩充的菜系功效代码
  • jquery+CSS达成的俯拾正是竖向展开树形TRee菜单效果
  • jquery达成可横向和竖向张开的动态下滑菜单成效
  • jquery完成点击向下举办菜单项(伸缩导航)效果
  • jquery完结带渐变淡入淡出并向右依次打开的二种菜单功效实例
  • jQuery完结可收缩张开的级联菜单实例代码
  • jQuery 淡入淡出、张开缩小菜单达成代码
  • jQuery完结鼠标悬停3d菜单举办动画效果

您或者感兴趣的小说:

  • 依照jQuery完毕以手风琴方式进行和折叠导航菜单
  • jQuery达成折叠、打开的菜谱组效果代码
  • jquery达成可点击伸缩与张开的菜系功能代码
  • jquery达成革命竖向多级向右展开的领航菜单成效
  • jquery+CSS实现的种类竖向展开树形TRee菜单效果
  • jquery实现点击向下张开菜单项(伸缩导航)效果
  • jquery落成带渐变淡入淡出并向右依次张开的一连串菜单作用实例
  • jQuery完毕可收缩张开的级联菜单实例代码
  • jQuery 淡入淡出、张开减弱菜单完毕代码
  • jQuery实现鼠标悬停3d菜单进行动画效果

本文由六合联盟网发布于系统操作,转载请注明出处:jquery实现可横向和竖向展开的动态下滑菜单功用

关键词: