search
HomeWeb Front-endJS TutorialjBox 2.3 is the latest multi-functional dialog plug-in based on jquery FAQ_jquery

Plug-in description
- jBox is a multi-functional dialog plug-in based on jQuery, which can achieve the overall style effect of the website and give users a new visual enjoyment.
Operating environment
- Compatible with IE6, Firefox, Chrome, Safari, Opera and other mainstream browsers.
Usage License
- jBox is free to use forever, but the relevant copyright information must be retained. If you have any good suggestions, you can leave a message directly below.


Version: 2.3
Size: 19.8k
Download: Click to download
Online demo: http://www.kudystudio.com/jbox/ jbox-demo.html
[2011-11-08] jBox v2.3 beta version update

Copy code The code is as follows :

- [New] The tip method adds an opacity option, which determines whether to display the isolation layer.
- [New] Added showScrolling option to hide the browser's scroll bars when displaying the jBox window.
- [New] When multiple windows coexist, when you click on a window title, the window will automatically be at the top.
- [Adjustment] The id option is changed to null by default. When it is null, a random id will be automatically generated, and only one jBox will be displayed for each id.
- [Adjustment] The loaded option adds a parameter h. The parameter h represents the jQuery object of the window content, which is convenient for users to initialize the content after the window is loaded.
- [Adjustment] Put global settings into independent js files and put them in the directory i18n. Currently, there is only jquery.jBox-zh-CN.js.
- [Adjustment] Pressing the space bar can directly execute the event submitted by the default button (to retain this functionality, the button does not look very good when it is focused, but the user experience should be prioritized).
- [Fix] Fixed the bug that the multi-window state cannot be displayed when switching between multiple windows in IE.

Usage:
Copy the code The code is as follows:




Common usage issues:
1. Please use the XHTML 1.0 standard

2. Don’t want to display the title?
Set title to null, for example: jBox('content', { title: null });
3. Don't want buttons? Custom button?
Set buttons to {} to not display buttons, for example: jBox('content', { buttons: {} });
Custom button: jBox('content', { buttons: {'Button 1 ':'Button 1 click return value','Button 2':'Button 2 click return value'} });
You can also set buttonsFocus which button you want to be the default button, and the index starts from 0
4. No Show isolation layer?
Set opacity to 0, for example: jBox('content', { opacity: 0 });
5. Will the window close automatically?
Set timeout to 0 to indicate that it will not close automatically. A positive number indicates how many milliseconds it will take to close automatically. For example, it will close after 3 seconds: jBox('content', { timeout: 3000 });
6. Do not display isolation In the case of layers, want to prevent multiple identical windows from popping up when clicking a button?
Just pass the id in, because an id will only display one window, for example: jBox('content', { id: 'my-id'});
7. The height and width of the window are certain Do you want to specify a value? Can it be adaptive?
In addition to iframe, in other cases, you can specify that the height and width of the window are adaptive, for example: jBox('content', { width: 'auto', height:'auto' });
jbox There are many optional parameters. Combining different parameters can have different effects. Please check the global parameter description below (in the file jquery.jBox-zh-CN.js). If you are using Simplified Chinese and do not want to change the global configuration, you do not need to load jquery.jBox-zh-CN.js, because the default settings in jquery.jBox-2.3.min.js are the same as jquery.jBox-zh-CN. js is the same. If you only want to modify certain options, such as window borders, you only need one line of code: jBox.setDefaults({ defaults: { border: 8} });
Friends who like jBox, don’t forget Click [Recommended] Oh, 3q
Copy code The code is as follows:

/* jBox global settings*/
var jBoxConfig = {};
jBoxConfig.defaults = {
id: null, /* The unique id in the page, if it is null then Automatically generate a random ID, one ID will only display one jBox */
top: '15%', /* The distance of the window from the top, which can be a percentage or pixel (such as '100px') */
border: 5, /* The pixel size of the outer border of the window must be an integer above 0*/
opacity: 0.1, /* The transparency of the window isolation layer. If set to 0, the isolation layer will not be displayed*/
timeout : 0, /* How many milliseconds will the window display before automatically closing? If set to 0, it will not automatically close*/
showType: 'fade', /* The type of window display. Optional values ​​are: show, fade, slide */
showSpeed: 'fast', /* The speed of window display. Optional values ​​are: 'slow', 'fast', and an integer representing milliseconds. */
showIcon: true, /* Whether to display the window title. icon, true to display, false not to display, or a custom CSS style class name (taking the icon as the background) */
showClose: true, /* Whether to display the close button in the upper right corner of the window*/
draggable: true, /* Whether the window can be dragged*/
dragLimit: true, /* When the window can be dragged, whether it is limited to the visible range*/
dragClone: ​​false, /* When the window can be dragged In the case of a window, whether to clone the window when the mouse is pressed */
persistent: true, /* When the isolation layer is displayed, whether to persist the window from closing when the isolation layer is clicked */
showScrolling: true , /* Whether to display the browsing scroll bar*/
ajaxData: {}, /* When the window content is identified with the get: or post: prefix, the data of the ajax post, for example: { id: 1 } or " id=1" */
iframeScrolling: 'auto', /* When the window content is identified by the iframe: prefix, the value of the scrolling attribute of the iframe. The optional values ​​are: 'auto', 'yes', 'no ' */
title: 'jBox', /* The title of the window*/
width: 350, /* The width of the window, the value is 'auto' or an integer representing pixels*/
height: ' auto', /* The height of the window, the value is 'auto' or an integer representing pixels*/
bottomText: '', /* The content to the left of the button of the window, this setting is invalid when there is no button*/
buttons: { 'OK': 'ok' }, /* Buttons of the window*/
buttonsFocus: 0, /* Indicates which button is the default button, and the index starts from 0*/
loaded: function ( h) { }, /* Function executed after the window is loaded. It should be noted that if it is ajax or iframe, the window loading will not be completed until the http request is loaded. The parameter h represents the jQuery object of the window content*/
submit: function (v, h, f) { return true; }, /* The callback function after clicking the window button. Returning true means closing the window. There are three parameters. v means the return value of the clicked button, and h means The jQuery object of the window content, f represents the form key value in the window content*/
closed: function () { } /* Function executed after the window is closed*/
};
jBoxConfig.stateDefaults = {
content: '', /* Status content, prefix identification is not supported*/
buttons: { 'OK': 'ok' }, /* Status button*/
buttonsFocus: 0, /* Indicates which button is the default button, and the index starts from 0*/
submit: function (v, h, f) { return true; } /* The callback function after clicking the status button, returning true means it is closed Window has three parameters, v represents the return value of the clicked button, h represents the jQuery object of the window content, and f represents the form key value in the window content*/
};
jBoxConfig.tipDefaults = {
content: '', /* Prompt content, prefix identification is not supported*/
icon: 'info', /* Prompt icon, optional values ​​​​are 'info', 'success', 'warning', 'error', 'loading', the default value is 'info', when it is 'loading', the timeout value will be set to 0, indicating that it will not automatically close.*/
top: '40%', /* The distance from the top of the prompt, which can be a percentage or pixels (such as '100px') */
width: 'auto', /* The height of the prompt, the value is 'auto' or an integer representing pixels*/
height: 'auto', /* The height of the prompt, the value is 'auto' or an integer representing pixels*/
opacity: 0, /* The height of the window isolation layer Transparency, if set to 0, the isolation layer will not be displayed*/
timeout: 3000, /* How many milliseconds will it take for the prompt to automatically close after it is displayed, which must be an integer greater than 0*/
loaded: function (h) { } /* Function executed after the window is loaded. The parameter h represents the jQuery object of the window content*/
};
jBoxConfig.messagerDefaults = {
content: '', /* Content of the message, prefix is ​​not supported Identity*/
title: 'jBox', /* The title of the message*/
icon: 'none', /* The message icon. When the value is 'none', the icon is not displayed. The optional value is 'none'. ', 'info', 'question', 'success', 'warning', 'error' */
width: 350, /* The height of the information, the value is 'auto' or an integer representing pixels */
height: 'auto', /* The height of the information, the value is 'auto' or an integer representing pixels*/
timeout: 3000, /* How many milliseconds after the information is displayed, it will automatically close. If set to 0, it will not automatically Close*/
showType: 'slide', /* Type of information display, optional values ​​are: show, fade, slide */
showSpeed: 600, /* Speed ​​of information display, optional values ​​are: 'slow', 'fast', an integer representing milliseconds*/
border: 0, /* The pixel size of the outer border of the message must be an integer above 0*/
buttons: {}, /* The pixel size of the message Buttons*/
buttonsFocus: 0, /* Indicates which button is the default button, and the index starts from 0*/
loaded: function () { }, /* Function executed after the window is loaded*/
submit: function (v, h, f) { return true; }, /* The callback function after clicking the information button. Returning true means closing the window. There are three parameters. v represents the return value of the clicked button, h jQuery object representing the window content, f represents the form key value in the window content*/
loaded: function (h) { } /* Function executed after the window is loaded, parameter h represents the jQuery object of the window content*/
};
jBoxConfig.languageDefaults = {
close: 'Close', /* Close button prompt in the upper right corner of the window*/
ok: 'OK', /* $.jBox.prompt() The "OK" button text of the series method */
yes: 'Yes', /* The "Yes" button text of the $.jBox.warning() method */
no: 'No', /* $. "No" button text for jBox.warning() method*/
cancel: 'Cancel' /* "Cancel" button text for $.jBox.confirm() and $.jBox.warning() methods*/
};
$.jBox.setDefaults(jBoxConfig);
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
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.

From C/C   to JavaScript: How It All WorksFrom C/C to JavaScript: How It All WorksApr 14, 2025 am 12:05 AM

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.

JavaScript Engines: Comparing ImplementationsJavaScript Engines: Comparing ImplementationsApr 13, 2025 am 12:05 AM

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.

Beyond the Browser: JavaScript in the Real WorldBeyond the Browser: JavaScript in the Real WorldApr 12, 2025 am 12:06 AM

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.

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

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)