This article mainly introduces the content of the menu corresponding to the jQuery simulation drop-down box selection. It is very good and has reference value. Friends in need can refer to it. I hope it can help everyone.
Let me show you the renderings first:
The following code will share with you the simulated drop-down box based on jquery to select the content of the corresponding menu. , the specific code is as follows:
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style type="text/css"> body,ul,li,a,p{margin: 0;padding: 0;} a{text-decoration: none; color: #555;font-size: 23px;} .zn-classreport-tabs{} .zn-classreport-tabstle{ font-size: 16px; position: relative; width: 200px; margin: 15px 20px; line-height: 35px; cursor: pointer; padding: 0px 16px; border: 1px solid #ccc; border-radius: 5px; } .zn-classreport-tabstle>ul{ display: none; position: absolute; top: 36px; left: 0; width: 90%; background: #fff; padding: 10px; border: 1px solid #ccc; } .zn-classreport-tabstle li{ float: left; text-align: center; width: 100%; font-size: 14px; margin-bottom: 4px; } .zn-classreport-tabstle li:hover,.zn-classreport-tabstle li.active{ background-color: #ccc; color: #fff; } .zn-classreport-tabscnt{ float: left; width: 100%; } .zn-classreport-tabsbox{ margin: 10px; display: none; font-size: 16px; } .zn-classreport-tabsbox.active{ display: block; } .zn-classreport-tabsbox img{ width: 350px; } </style> </head> <body> <p class="zn-classreport-tabs"> <p class="zn-classreport-tabstle"> <span>请选择课程</span> <input type="hidden" name="test_1" class="value" value="" /> <ul class="select"> <li value="1">蒙妮妮摄影班</li> <li value="2">昕丽冲印班</li> <li value="3">宝丽冲印班</li> </ul> </p> <p class="zn-classreport-tabscnt"> <p class="zn-classreport-tabsbox active"> <p class="zn-classreport-tabsbox-fl"> <img class="img lazy" src="/static/imghwm/default1.png" data-src="upload/images/u149.jpg" alt="jQuery simulates drop-down box to select corresponding menu" > <p class="text"> <p>蒙妮妮摄影班</p> <p><span>课程介绍:</span></p><p><span><br></span></p><p><span>本课程包括摄影基础、曝光、构图,器材的使用</span></p><p><span>和摄影小技巧,风光摄影初级,人像摄影及婚纱</span></p><p><span>摄影,产品摄影,重点讲解人像写真与私房摄影,</span></p><p><span>作品点评,PS基础、数码调色与常用技巧。</span></p> </p> </p> <p class="zn-classreport-tabsbox-fr"></p> </p> <p class="zn-classreport-tabsbox "> <p class="zn-classreport-tabsbox-fl"> <img class="img lazy" src="/static/imghwm/default1.png" data-src="upload/images/goods-index-1.jpg" alt="jQuery simulates drop-down box to select corresponding menu" > <p class="text"> <p>昕丽冲印班</p> <p><span>课程介绍:</span></p><p><span><br></span></p><p><span>本课程包括摄影基础、曝光、构图,器材的使用</span></p><p><span>和摄影小技巧,风光摄影初级,人像摄影及婚纱</span></p><p><span>摄影,产品摄影,重点讲解人像写真与私房摄影,</span></p><p><span>作品点评,PS基础、数码调色与常用技巧。</span></p> </p> </p> </p> <p class="zn-classreport-tabsbox "> <p class="zn-classreport-tabsbox-fl"> <img class="img lazy" src="/static/imghwm/default1.png" data-src="upload/images/wifi_04.jpg" alt="jQuery simulates drop-down box to select corresponding menu" > <p class="text"> <p>宝丽冲印班</p> <p><span>课程介绍:</span></p><p><span><br></span></p><p><span>本课程包括摄影基础、曝光、构图,器材的使用</span></p><p><span>和摄影小技巧,风光摄影初级,人像摄影及婚纱</span></p><p><span>摄影,产品摄影,重点讲解人像写真与私房摄影,</span></p><p><span>作品点评,PS基础、数码调色与常用技巧。</span></p> </p> </p> </p> </p> </p> <script src="js/jquery-1.7.2.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ //报班系列 $('.zn-classreport-tabs ').each(function(){ var _this = $(this); var cur_tab = false; //当前标签 $(_this).find('.zn-classreport-tabstle').each(function(){ var _tlethis = $(this); var select = $(this).find('.select'); var hidden = $(this).find('.value'); var span = $(this).find('span'); $( _tlethis).click(function(){ $(select).show(); }) $(_tlethis).find('ul.select li').each(function(){ $(this).click(function(){ $(hidden).val( $(this).attr('value') ); $(select).hide(); $(span).html($(this).html()); return false; }); }); }); //多标签内容处理 $(_this).find('.zn-classreport-tabstle li').click(function(){ if (cur_tab == this) { return true; } now_pos = $(cur_tab).index();//开始的 new_pos = $(this).index();//当前的 $(_this).find('.zn-classreport-tabsbox').eq(now_pos).removeClass('active'); $(_this).find('.zn-classreport-tabsbox').eq(new_pos).addClass('active'); $(cur_tab).removeClass('active'); $(this).addClass('active'); cur_tab=this; }); $(_this).find('.zn-classreport-tabstle li').first().click(); }); }); </script> </body> </html>
Related recommendations:
JavaScript implementation of adding and deleting elements to the select drop-down box Share
jQuery uses EasyUi to implement three-level linkage drop-down box effect example sharing
jQuery implements select drop-down box to obtain the currently selected text
The above is the detailed content of jQuery simulates drop-down box to select corresponding menu. For more information, please follow other related articles on the PHP Chinese website!

JavaScript's application in the real world includes front-end and back-end development. 1) Display front-end applications by building a TODO list application, involving DOM operations and event processing. 2) Build RESTfulAPI through Node.js and Express to demonstrate back-end applications.

The main uses of JavaScript in web development include client interaction, form verification and asynchronous communication. 1) Dynamic content update and user interaction through DOM operations; 2) Client verification is carried out before the user submits data to improve the user experience; 3) Refreshless communication with the server is achieved through AJAX technology.

Understanding how JavaScript engine works internally is important to developers because it helps write more efficient code and understand performance bottlenecks and optimization strategies. 1) The engine's workflow includes three stages: parsing, compiling and execution; 2) During the execution process, the engine will perform dynamic optimization, such as inline cache and hidden classes; 3) Best practices include avoiding global variables, optimizing loops, using const and lets, and avoiding excessive use of closures.

Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.

Python and JavaScript have their own advantages and disadvantages in terms of community, libraries and resources. 1) The Python community is friendly and suitable for beginners, but the front-end development resources are not as rich as JavaScript. 2) Python is powerful in data science and machine learning libraries, while JavaScript is better in front-end development libraries and frameworks. 3) Both have rich learning resources, but Python is suitable for starting with official documents, while JavaScript is better with MDNWebDocs. The choice should be based on project needs and personal interests.

The shift from C/C to JavaScript requires adapting to dynamic typing, garbage collection and asynchronous programming. 1) C/C is a statically typed language that requires manual memory management, while JavaScript is dynamically typed and garbage collection is automatically processed. 2) C/C needs to be compiled into machine code, while JavaScript is an interpreted language. 3) JavaScript introduces concepts such as closures, prototype chains and Promise, which enhances flexibility and asynchronous programming capabilities.

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

JavaScript's applications in the real world include server-side programming, mobile application development and Internet of Things control: 1. Server-side programming is realized through Node.js, suitable for high concurrent request processing. 2. Mobile application development is carried out through ReactNative and supports cross-platform deployment. 3. Used for IoT device control through Johnny-Five library, suitable for hardware interaction.


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!

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

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver CS6
Visual web development tools