search
HomeWeb Front-endJS Tutorialboxy pop-up layer dialog plug-in extension application based on jquery pop-up layer selector_jquery

We use the popular jquery for design, and at the same time we choose the boxy pop-up plug-in with excellent effect for expansion (for information about boxy, please refer to Zhang Xinxu’s blog http://www.zhangxinxu.com/wordpress/?p=318). The following introduces the application of boxy as a selector framework.

I believe that anyone who has used the recruitment website will be familiar with the selector (it is the one that pops up when you click on it to select the industry, position and region). The difficulty of the selector lies in style debugging, which is mainly aimed at It's IE6. Here we introduce the industry, position and region selectors. The downloaded demo contains these three selectors.

Industry selector: no association, the calling statement is Boxy.industry(value, callback, options), the parameter value is a set of selected value numbers (string type, separated by commas), and the callback is A callback function can be defined. The value passed into the callback is a set of numbers of the selected items in the industry selector (string type, separated by commas), and options are optional parameters of the boxy plug-in.

Call example: select industries numbered 1 and 2, and define the selector title as "Industry Category Selector"

Copy code The code is as follows:

$("#industry").click(function() {
Boxy.industry("1,2", function(val) {
alert("You selected: " val);
}, { title: "Industry Category Selector" });
return false;
});


Job selector: two-level connection, the calling statement is Boxy.job(value, shown, callback, options), the parameter value is a set of selected value numbers (string type, between numbers) Comma-separated, starting with b indicates selecting a major job category, starting with s indicates selecting a subcategory), the parameter shown indicates the number of the displayed job category, the parameter callback is a definable callback function, and the value passed in to callback is the position selector. A set of numbers for the selected items (string type, separated by commas), options are optional parameters of the boxy plug-in.

Call example: Select the job subcategory numbered 1, the job category numbered 2, define the name of the selector as position category selector
Copy code The code is as follows:

$("#job").click(function() {
Boxy.job("s1,b2" , "2", function(val) {
alert("You selected: " val);
}, { title: "Position Category Selector" });
return false;
});


Position selector: three cascades, the calling statement is Boxy.area(value, shown, callback, options), the parameter value is the selected value Number set (string type, separated by commas, starting with p means selecting a province, starting with c means selecting a city, starting with d means selecting a county), the parameter shown represents the number of the displayed region, and the parameter callback is definable Callback function, the value passed into the callback is the number set of the selected items in the region selector (string type, numbers are separated by commas), and options are the optional parameters of the boxy plug-in.

Call example: select counties or districts numbered 1 and 2, define the name of the selector as work area selector
Copy code The code is as follows:

$("#city").click(function() {
Boxy.area("d1,c7", "1,724", function (val) {
alert("You selected: " val);
}, { title: "Work Area Selector" });
return false;
});


There are bugs:

1. The margin setting of IE6 checkbox will be distorted. Clearing the checkbox border of IE6 is invalid, but it is effective for other browsers, and many people like it. Globally set input margin/padding to zero. In order to unify the style, IE6 can only be ignored.

2. In the IE8 environment, the hover effect of the css setting option is slow or even unresponsive. This problem does not exist in other browsers (including IE6), and the js code solution is not an option. The code hover The response is still a bit slow. I really don’t understand why IE8 has this problem. Someone who knows can tell me.

3. The display area of ​​the overly long selected item under IE6 is not enough, and it will not automatically wrap in the parent tag. Instead, the displayed text will be wrapped in the selected item itself, causing the style to be aliased. I don't know how to solve this problem, can anyone tell me.

4. Haven’t found it yet (maybe you will talk about the hover effect of the OK button under IE6. This is not a bug, but it is irrelevant and I am too lazy to change it. Just change the label to
, but I really don’t like and spend all day doing useless work on IE6).

Advantages:

1. Of course it’s beautiful!

2. The three selectors respectively represent the selectors of three cascading relationships. You can directly modify the data source in the Demo and the text in the main frame to change it into other selectors.

3. There is still room for improvement. Who can integrate the css style of the demo and post it?

Let me tell you quietly that the rounded corner effect of the selector's outer frame is achieved using png images. If you want to change the transparency, you have to redo the image. If you are willing to leave IE6 aside, you can use another commonly used method. The rounded corner method (no pictures, only css styles), the method has been written into the boxy plug-in (I commented it out, including the style file), and there is also a rounded corner method that is also introduced in the round-corner.html file of the demo Now, ExtendedBoxy.html is the demo file of the selector. The other two html files about Boxy were written by Zhang Xinxu. There are a lot of good things on Zhang Xinxu’s blog http://www.zhangxinxu.com/php/. Please check it out when you have time.

Demo download address:
/201011/yuanma/jquery-plugin-ExtendedBoxy.rar
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
From Websites to Apps: The Diverse Applications of JavaScriptFrom Websites to Apps: The Diverse Applications of JavaScriptApr 22, 2025 am 12:02 AM

JavaScript is widely used in websites, mobile applications, desktop applications and server-side programming. 1) In website development, JavaScript operates DOM together with HTML and CSS to achieve dynamic effects and supports frameworks such as jQuery and React. 2) Through ReactNative and Ionic, JavaScript is used to develop cross-platform mobile applications. 3) The Electron framework enables JavaScript to build desktop applications. 4) Node.js allows JavaScript to run on the server side and supports high concurrent requests.

Python vs. JavaScript: Use Cases and Applications ComparedPython vs. JavaScript: Use Cases and Applications ComparedApr 21, 2025 am 12:01 AM

Python is more suitable for data science and automation, while JavaScript is more suitable for front-end and full-stack development. 1. Python performs well in data science and machine learning, using libraries such as NumPy and Pandas for data processing and modeling. 2. Python is concise and efficient in automation and scripting. 3. JavaScript is indispensable in front-end development and is used to build dynamic web pages and single-page applications. 4. JavaScript plays a role in back-end development through Node.js and supports full-stack development.

The Role of C/C   in JavaScript Interpreters and CompilersThe Role of C/C in JavaScript Interpreters and CompilersApr 20, 2025 am 12:01 AM

C and C play a vital role in the JavaScript engine, mainly used to implement interpreters and JIT compilers. 1) C is used to parse JavaScript source code and generate an abstract syntax tree. 2) C is responsible for generating and executing bytecode. 3) C implements the JIT compiler, optimizes and compiles hot-spot code at runtime, and significantly improves the execution efficiency of JavaScript.

JavaScript in Action: Real-World Examples and ProjectsJavaScript in Action: Real-World Examples and ProjectsApr 19, 2025 am 12:13 AM

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.

JavaScript and the Web: Core Functionality and Use CasesJavaScript and the Web: Core Functionality and Use CasesApr 18, 2025 am 12:19 AM

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 the JavaScript Engine: Implementation DetailsUnderstanding the JavaScript Engine: Implementation DetailsApr 17, 2025 am 12:05 AM

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 vs. JavaScript: The Learning Curve and Ease of UsePython vs. JavaScript: The Learning Curve and Ease of UseApr 16, 2025 am 12:12 AM

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 vs. JavaScript: Community, Libraries, and ResourcesPython vs. JavaScript: Community, Libraries, and ResourcesApr 15, 2025 am 12:16 AM

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.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools