


jQuery boxy pop-up layer plug-in Chinese demonstration and usage explanation_jquery
使用该jQuery插件
要想使用该jQuery插件,需要把$(selector).boxy();放在document.ready中。使用合适的选择器表达式替换这里的"selector",例如:"a[rel=boxy],form.with-confirmation"。这会给匹配的元素附加一些行为,如下:
一个href属性中如果锚点包含#,则此锚点相对应的ID的DOM元素的内容就会被添加到boxy对话框中。
如果href锚点内容为其他一些东西,则会试图使用Ajax载入其对应的内容。理想情况下,我们有相同的起源检查和委托对框架的跨域请求。这将会在下面展示。
表单上会显示一个提交模式的确认消息。
其他的元素将会被忽略
手动创建实例
用手动模式使用boxy是很容易的——只需要创建一个boxy的新实例,传递一些内部的内容和任何附加的散列对象。在默认情况下,对话框会立即显示出来,在视角的中心,可拖拽。所有的这些设置都可以通过给构造函数传递附加的对象来进行覆盖——更多详情请参见下面的构造函数选项
传递给构造函数的内容可以是任何有效的参数,jQuery的$()函数- DOM元素,是HTML片断或其他jQuery对象。无论提供的是什么,其display属性均被设置为block,并插入名为boxy-content的class在对话框中。
下面为一些代表性的示例:
- 创建一个新的对话框,new Boxy("
内容……
", {title: "对话框"});。 - 创建一个新对话框,无法拖拽。new Boxy("
内容……
", {title: "对话框", draggable: false});。 - 创建一个新的对话框,没有默认的关闭按钮。new Boxy("
内容……
", {title: "对话框", closeable:false});。 - 新建对话框,使用absolute绝对定位(跟随滚动条)new Boxy("
内容……
", {title: "对话框, fixed:false"});。 - 新建对话框,模态的new Boxy("
内容……
", {title: "对话框, modal:true"});。 - 新建对话框,自定义行为new Boxy("
内容……
", {behaviours: function(r) { $(r).hover(function() { $(this).css("background-color", "red"); }, function() { $(this).css("background-color", "white"); }); }});。
修改现有的对话(先打开一个对话框,然后再单击下面的链接事件)
- 让最新的对话框放大的动画 - someDialog.tween(400, 400);
- 让最新的对话框减小的动画 - someDialog.tween(100, 100);
- 获取最新的对话框的标题 - someDialog.getTitle();。
- 更改最新的对话框的标题 - someDialog.setTitle("新标题");
请注意,标题栏(也就是关闭按钮和拖动器)只有在标题指定的情况下会出现,在未来,这种行为可能会发生变化,使标题栏始终存在,除非特别禁用。
一旦您创建了一个实例,您可以将通过提供的API分配给一个变量,随后移动,改变大小,显示和隐藏 - 记录如下。
提问
使用Boxy.ask(),Boxy.alert()和Boxy.confirm()这些帮手可能提示用户从一些选项中进行选择以及完成可选的回调函数。点击下面含有演示的链接,参考API文档获取更多信息。
- 提问 - Boxy.ask() - 用户定义的选项,选择项传递给回调函数
- 弹出 - Boxy.alert() - 回调函数总是不被调用
- 确认 - Boxy.confirm() - 仅当用户选择了“确认”时回调函数会被调用
Boxy.load(url, options)
- 类型 - HTTP方法,默认为GET
- 缓存 - 如果是true,缓存内容连续通话。相当于缓存选项传递到jQuery的Ajax方法。默认:false。
- 过滤 - jQuery的表达式,用于过滤远程内容。
Boxy.get(element)
<a href="#" onclick="Boxy.get(this).hide();">关闭对话框</a>
Boxy.ask(question, answers, callback, options)
Boxy.alert(message, callback, options)
注意:此方法并不是为了取代浏览器本地window.alert()函数提供,因为它没有能力阻止程序执行,在对话框是可见的时候。
Boxy.confirm(message, callback, options)
注意:此方法并不是为了取代浏览器提供的本地window.confirm()函数,因为它没有能力在对话框可见时阻止程序执行的。
Boxy.linkedTo(ele)
Boxy.isModalVisible()
new Boxy(element, options)
estimateSize()
getSize()
getContentSize()
getPosition()
getCenter()
getInner()
getContent()
setContent(newContent)
moveTo(x,y)
centerAt(x,y)
center(axis)
resize(w,h,after)
tween(w,h,after)
isVisible()
show()
hide(after)
toggle()
hideAndUnload(after)
unload()
toTop()
getTitle()
setTitle(t)
- 选项
- 描述
- 默认
- title
- 显示在自动生成标题栏上的标题
- null
- closeable
- 是否一个关闭对话框的驱动器要添加到自动生成标题栏上。如果标题没有指定是没有影响的。
- true
- closeText
- 在可用情况下标题栏关闭链接的文字
- "[关闭]"
- draggable
- 是否对话框可以通过标题栏进行拖拽。标题未指定没有影响。
- true
- clone
- 内部区域的元素以及事件处理程序应不应该在被替换之前进行复制。
- false
- actuator
- DOM元素(不包括jQuery对象),引发此对话框。两者之间的联系将被建立,此联系允许对话框的参照稍后在通过执行Boxy.linkedTo(element)获取的元素中进行检索。当对话框被卸载,此联系也会被自动切断。
- null
- center
- 对话框是否屏幕中心显示
- true
- fixed
- 是否使用固定定位(fixed)而不是绝对定位(absolute),固定定位的对话框不受浏览器滚动条影响。IE6不支持固定定位,其永远表现为绝对定位。
- true
- show
- 对话框是否需要立即显示,如果是false,则需要你手动调用dialog.show()以显示对话框。
- true
- modal
- 对话框是否设置为模态。模态时,浏览器背景“黑黑的”,阻止页面的其他元素接受事件。
- false
- x
- 对话框的x(left)坐标
- 50
- y
- 对话框的y(top)坐标
- 50
- unloadOnHide
- 如果是true,则在此对话框隐藏后会被卸载(如从DOM中删除)
- false
- clickToFront
- 如果是true,则单击对话框的任意位置(只是相对于标题栏),会导致其跑到顶部。
- false
- behaviours
- 函数用来申请对话框内容的自定义行为。每次调用setContent(),且在Boxy对象中的上下文中执行,将接受一个包含内容区域的jQuery对象作为参数。
- function(r){}
- afterDrop
- 当对话框放下的时候在Boxy对象的上下文执行回调函数。
- function(){}
- afterShow
- 当对话框显示的时候在Boxy对象的上下文执行回调函数。能够用来使表单的文本框获取焦点。
- function(){}
- afterHide
- 当对话框隐藏的时候在Boxy对象的上下文执行回调函数。
- fuuction(){}
- beforeUnload
- 在对话框卸载前在Boxy对象的上下文执行回调函数。
- function(){}
可以通过css完全定制对话框的外观,这里的是您可能感兴趣的选择器列表。
.boxy-wrapper .title-bar
.boxy-wrapper .title-bar h2
.boxy-wrapper .title-bar.dragging
.boxy-wrapper .title-bar .close
.boxy-inner
.boxy-content
.boxy-wrapper .question
.boxy-wrapper .answers
.닫기
온라인 데모http://demo.jb51.net/js/2011/jquery-plugin-boxy/page/jQuery-plugin-boxy.html
패키지 다운로드http: //xiazai.jb51.net/201102/yuanma/jquery-plugin-boxy.rar

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Detailed explanation of jQuery reference method: Quick start guide jQuery is a popular JavaScript library that is widely used in website development. It simplifies JavaScript programming and provides developers with rich functions and features. This article will introduce jQuery's reference method in detail and provide specific code examples to help readers get started quickly. Introducing jQuery First, we need to introduce the jQuery library into the HTML file. It can be introduced through a CDN link or downloaded

How to use PUT request method in jQuery? In jQuery, the method of sending a PUT request is similar to sending other types of requests, but you need to pay attention to some details and parameter settings. PUT requests are typically used to update resources, such as updating data in a database or updating files on the server. The following is a specific code example using the PUT request method in jQuery. First, make sure you include the jQuery library file, then you can send a PUT request via: $.ajax({u

jQuery is a fast, small, feature-rich JavaScript library widely used in front-end development. Since its release in 2006, jQuery has become one of the tools of choice for many developers, but in practical applications, it also has some advantages and disadvantages. This article will deeply analyze the advantages and disadvantages of jQuery and illustrate it with specific code examples. Advantages: 1. Concise syntax jQuery's syntax design is concise and clear, which can greatly improve the readability and writing efficiency of the code. for example,

Title: jQuery Tips: Quickly modify the text of all a tags on the page In web development, we often need to modify and operate elements on the page. When using jQuery, sometimes you need to modify the text content of all a tags in the page at once, which can save time and energy. The following will introduce how to use jQuery to quickly modify the text of all a tags on the page, and give specific code examples. First, we need to introduce the jQuery library file and ensure that the following code is introduced into the page: <

Title: Use jQuery to modify the text content of all a tags. jQuery is a popular JavaScript library that is widely used to handle DOM operations. In web development, we often encounter the need to modify the text content of the link tag (a tag) on the page. This article will explain how to use jQuery to achieve this goal, and provide specific code examples. First, we need to introduce the jQuery library into the page. Add the following code in the HTML file:

How to remove the height attribute of an element with jQuery? In front-end development, we often encounter the need to manipulate the height attributes of elements. Sometimes, we may need to dynamically change the height of an element, and sometimes we need to remove the height attribute of an element. This article will introduce how to use jQuery to remove the height attribute of an element and provide specific code examples. Before using jQuery to operate the height attribute, we first need to understand the height attribute in CSS. The height attribute is used to set the height of an element

jQuery is a popular JavaScript library that is widely used to handle DOM manipulation and event handling in web pages. In jQuery, the eq() method is used to select elements at a specified index position. The specific usage and application scenarios are as follows. In jQuery, the eq() method selects the element at a specified index position. Index positions start counting from 0, i.e. the index of the first element is 0, the index of the second element is 1, and so on. The syntax of the eq() method is as follows: $("s

jQuery is a popular JavaScript library widely used in web development. During web development, it is often necessary to dynamically add new rows to tables through JavaScript. This article will introduce how to use jQuery to add new rows to a table, and provide specific code examples. First, we need to introduce the jQuery library into the HTML page. The jQuery library can be introduced in the tag through the following code:
