Blue secondary navigation bar effect code implemented by jquery_jquery
The example in this article describes the blue secondary navigation bar effect code implemented by jquery. Share it with everyone for your reference. The details are as follows:
This is a website navigation bar effect code. The menu can support up to two levels, which is suitable for many types of websites. If you don’t like blue, you can modify it to other colors. The overall effect is good, and it is a very simple website navigation.
The screenshot of the running effect is as follows:
The online demo address is as follows:
http://demo.jb51.net/js/2015/jquery-blue-2level-nav-style-codes/
The specific code is as follows:
<!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> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>css+jquery打造二级横向菜单</title> <style type="text/css" /> #droplinebar {overflow: hidden;} .droplinebar ul{ margin: 0; padding: 0; float: left; width: 100%; font: bold 14px Arial, Helvetica, sans-serif,微软雅黑; text-align:center; background: #006b96 url(images/blueactive.gif) center center repeat-x;} .droplinebar ul li{display: inline;} .droplinebar ul li a{ float: left; display: block; color: white; width: 127px; padding:11px 2px; text-decoration: none;} .droplinebar ul li a:visited{color: white;} .droplinebar ul li a:hover, .droplinebar ul li .current{ color: white;background: transparent url(images/bluedefault.gif) center center repeat-x;padding:11px 2px;} .droplinebar ul li ul{ position: absolute; z-index: 100; padding: 5px 0; top: 0; background: #006791; visibility: hidden;} .droplinebar ul li ul li a{ font: bold 14px 微软雅黑,Arial, Helvetica, sans-serif; padding:5px 0; margin: 0;} .droplinebar ul li ul li a:hover{ background: #024662;} </style> <script type="text/javascript" src="jquery-1.6.2.min.js"></script> <script type="text/javascript"> var droplinemenu={ arrowimage: {classname: 'downarrowclass', src: 'images/down.gif', leftpadding: 5}, animateduration: {over: 200, out: 100}, buildmenu:function(menuid){ jQuery(document).ready(function($){ var $mainmenu=$("#"+menuid+">ul") var $headers=$mainmenu.find("ul").parent() $headers.each(function(i){ var $curobj=$(this) var $subul=$(this).find('ul:eq(0)') this._dimensions={h:$curobj.find('a:eq(0)').outerHeight()} this.istopheader=$curobj.parents("ul").length==1? true : false if (!this.istopheader) $subul.css({left:0, top:this._dimensions.h}) var $innerheader=$curobj.children('a').eq(0) $innerheader=($innerheader.children().eq(0).is('span'))? $innerheader.children().eq(0) : $innerheader $innerheader.append( '<img src="'+ droplinemenu.arrowimage.src +'" class="' + droplinemenu.arrowimage.classname + '" style="border:0; padding-left: '+droplinemenu.arrowimage.leftpadding+'px" />' ) $curobj.hover( function(e){ var $targetul=$(this).children("ul:eq(0)") if ($targetul.queue().length<=1) //if 1 or less queued animations if (this.istopheader) $targetul.css({left: $mainmenu.offset().left, top: $mainmenu.offset().top+this._dimensions.h}) if (document.all && !window.XMLHttpRequest) //detect IE6 or less, fix issue with overflow $mainmenu.find('ul').css({overflow: (this.istopheader)? 'hidden' : 'visible'}) $targetul.slideDown(droplinemenu.animateduration.over) }, function(e){ var $targetul=$(this).children("ul:eq(0)") $targetul.slideUp(droplinemenu.animateduration.out) } ) //end hover }) //end $headers.each() $mainmenu.find("ul").css({display:'none', visibility:'visible', width:$mainmenu.width()}) }) //end document.ready } }</script> <script type="text/javascript"> droplinemenu.buildmenu("mydroplinemenu") </script> </head> <body> <div id="mydroplinemenu" class="droplinebar"> <ul> <li><a href="#" >网站首页</a></li> <li><a href="#" >网络营销教程</a> <ul> <li><a href="#">基础知识教程</a></li> <li><a href="#">课内实践教程</a></li> <li><a href="#">专项实践教程</a></li> <li><a href="#">毕业论文安排</a></li> </ul> </li> <li><a href="#" >Flash源码</a></li> <li><a href="#" >Photoshop教程</a> <ul> <li><a href="#">基础教程</a></li> <li><a href="#">5步实例教程</a></li> <li><a href="#">文字与按钮教程</a></li> <li><a href="#">图片教程</a></li> <li><a href="#">笔刷等下载</a></li> <li><a href="#">源文件下载</a></li> <li><a href="#">字体下载</a></li> </ul> </li> <li><a href="#" >博客代码</a> <ul> <li><a href="#">博客大巴模板</a></li> <li><a href="#">博客大巴代码</a></li> <li><a href="#">和讯博客代码</a></li> </ul> </li> <li><a href="#" >网店经营</a></li> <li><a href="#" >网络营销研究</a> </li> </ul> </div> </body> </html>
I hope this article will be helpful to everyone’s jquery programming design.

JavaScript core data types are consistent in browsers and Node.js, but are handled differently from the extra types. 1) The global object is window in the browser and global in Node.js. 2) Node.js' unique Buffer object, used to process binary data. 3) There are also differences in performance and time processing, and the code needs to be adjusted according to the environment.

JavaScriptusestwotypesofcomments:single-line(//)andmulti-line(//).1)Use//forquicknotesorsingle-lineexplanations.2)Use//forlongerexplanationsorcommentingoutblocksofcode.Commentsshouldexplainthe'why',notthe'what',andbeplacedabovetherelevantcodeforclari

The main difference between Python and JavaScript is the type system and application scenarios. 1. Python uses dynamic types, suitable for scientific computing and data analysis. 2. JavaScript adopts weak types and is widely used in front-end and full-stack development. The two have their own advantages in asynchronous programming and performance optimization, and should be decided according to project requirements when choosing.

Whether to choose Python or JavaScript depends on the project type: 1) Choose Python for data science and automation tasks; 2) Choose JavaScript for front-end and full-stack development. Python is favored for its powerful library in data processing and automation, while JavaScript is indispensable for its advantages in web interaction and full-stack development.

Python and JavaScript each have their own advantages, and the choice depends on project needs and personal preferences. 1. Python is easy to learn, with concise syntax, suitable for data science and back-end development, but has a slow execution speed. 2. JavaScript is everywhere in front-end development and has strong asynchronous programming capabilities. Node.js makes it suitable for full-stack development, but the syntax may be complex and error-prone.

JavaScriptisnotbuiltonCorC ;it'saninterpretedlanguagethatrunsonenginesoftenwritteninC .1)JavaScriptwasdesignedasalightweight,interpretedlanguageforwebbrowsers.2)EnginesevolvedfromsimpleinterpreterstoJITcompilers,typicallyinC ,improvingperformance.

JavaScript can be used for front-end and back-end development. The front-end enhances the user experience through DOM operations, and the back-end handles server tasks through Node.js. 1. Front-end example: Change the content of the web page text. 2. Backend example: Create a Node.js server.

Choosing Python or JavaScript should be based on career development, learning curve and ecosystem: 1) Career development: Python is suitable for data science and back-end development, while JavaScript is suitable for front-end and full-stack development. 2) Learning curve: Python syntax is concise and suitable for beginners; JavaScript syntax is flexible. 3) Ecosystem: Python has rich scientific computing libraries, and JavaScript has a powerful front-end framework.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version
Visual web development tools

Atom editor mac version download
The most popular open source editor
