![jquery实现带渐变淡入淡出并向右依次展开的多级菜单效果实例【jquery】](https://900zi.500zi.com/uploadfile/img/14/552/3f70faee531edaa06e4480de0a00f2a0.jpg)
web前端|js教程
jquery,渐变,淡入淡出,展开,多级菜单
web前端-js教程
本文实例讲述了jquery实现带渐变淡入淡出并向右依次展开的多级菜单效果。分享给大家供大家参考。具体如下:
三分销网站源码下载,ubuntu宽带连接不了,tomcat数据库自动断开,爬虫专家奥斯汀史蒂文斯,php代码可以放在什么地方,新都seo优化lzw
这是一款核心基于jquery的多级导航菜单特效,横向向右依次展开菜单项,当然本菜单并不是完美的,因此没有怎么美化,另外包括子菜单的上级菜单中缺少一个菜单标记,这样用户有时候不知道哪个菜单中含有下级子菜单。不过添加这样一个标记似乎挺简单,你可以自己动手添加吧。
phpcms仿模板无忧源码,ubuntu 任务条插件,安装tomcat的环境配置,不叫的爬虫,index.php黑料,个人网站seo找行者SEOlzw
运行效果截图如下:
浏览器源码,vscode后端接口存放位置,ubuntu触控板失灵,tomcat布置静态页面,c爬虫制作,php中文变量名,黄石计算机seo推广价格,html个人网站设计模板lzw
在线演示地址如下:
/js//jquery-right-show-menu-codes/
具体代码如下:
jquery多级下拉侧导航amazonmenu.amazonmenu ul {font: normal 12px Verdana;list-style: none;margin: 0;padding: 0;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;}.amazonmenu ul li {position: static; }.amazonmenu > ul {background: white;border: 1px solid gray;border-radius: 5px;width: 200px;height: 400px;position: relative;}.amazonmenu > ul li a {color: black;display: block;overflow: auto;padding: 10px 0;position: relative;text-decoration: none;text-indent: 10px;}.amazonmenu > ul li.hassub > a::after { border: 5px solid transparent; border-left-color: gray; content: \; height: 0; position: absolute; right: 5px; top: 35%; width: 0;}.amazonmenu > ul li.hassub.selected > a::after { border-left-color: red;}.amazonmenu ul li a:hover, .amazonmenu ul li.hassub.selected > a {background: lightblue;color: navy;}.amazonmenu ul li > div, .amazonmenu ul li > ul {background: white;border: 1px solid gray;border-radius: 0 8px 8px 0;box-shadow: 2px 2px 2px gray;display: none;font-weight: normal;width: 300px;height: 400px;left: 100%;padding: 10px;position: absolute;top: 0;-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;z-index: 1000;}/* CSS Media queries */@media screen and (max-width: 480px) { .amazonmenu ul li > div, .amazonmenu ul li > ul { left: 30px;}.amazonmenu > ul li.hassub.selected::after { background: #eee; content: \; height: 100%; left: 0; opacity: .8; pointer-events: none; position: absolute; top: 0; width: 100%; z-index: 1;}}document.createElement("nav") // for IEvar amazonmenu = { defaults: { animateduration: 100, showhidedelay: [100, 100], hidemenuonclick: true }, setting: {}, menuzindex: 1000, touchenabled: !!(ontouchstart in window) || !!(ontouchstart in document.documentElement) || !!window.ontouchstart || !!window.Touch || !!window.onmsgesturechange || (window.DocumentTouch && window.document instanceof window.DocumentTouch), showhide:function($li, action, setting){ clearTimeout( $li.data(showhidetimer) ) if (action == show){ $li.data().showhidetimer = setTimeout(function(){ $li.addClass(selected) $li.data($submenu).data(fullyvisible, false).css({zIndex: amazonmenu.menuzindex++}).fadeIn(setting.animateduration, function(){$(this).data(fullyvisible, true)}) }, this.setting.showhidedelay[0]) } else{ $li.data().showhidetimer = setTimeout(function(){ $li.removeClass(selected) $li.data($submenu).stop(true, true).fadeOut(setting.animateduration) var $subuls = $li.data($submenu).find(.issub).css({display:
one}) if ($subuls.length > 0){$subuls.data($parentli).removeClass(selected) } }, this.setting.showhidedelay[1]) } }, setupmenu:function($menu, setting){ var $topul = $menu.children(ul:eq(0)) function addevtstring(cond, evtstr){ return (cond)? + evtstr : \ } $topul.find(li>div, li>ul).each(function(){ // find drop down elements var $parentli = $(this).parent(li) var $dropdown = $(this) $parentli .addClass(hassub) .data({$submenu: $dropdown, showhidetimer: null}) .on(mouseenter click, function(e){amazonmenu.showhide($(this), show, setting) }) .on(click, function(e){e.stopPropagation() }) .children(a).on(click, function(e){e.preventDefault() // prevent menu anchor links from firing }) $dropdown .addClass(issub) .data({$parentli: $parentli}) .on(mouseleave + addevtstring(setting.hidemenuonclick || amazonmenu.touchenabled, click), function(e){if ($(this).data(fullyvisible) == true){amazonmenu.showhide($(this).data($parentli), hide, setting)}if (e.type == click){e.stopPropagation()} }) }) // end find $topul.on(click, function(e){ if ($(this).data(fullyvisible) == true){ amazonmenu.showhide($(this).children(li.hassub.selected), hide, setting) } }) var $mainlis = $topul.children(li.hassub).on(mouseleave, function(){ amazonmenu.showhide($(this), hide, setting) }) }, init:function(options){ var $menu = $(# + options.menuid) this.setting = $.extend({}, options, this.defaults) this.setting.animateduration = Math.max(50, this.setting.animateduration) this.setupmenu($menu, this.setting) }}jQuery(function(){ amazonmenu.init({ menuid: mysidebarmenu })})