来源地
http://stefangabos.ro/jquery/zebra-dialog/
测试html文件主要代码
<body>
<button id="button1">click Me 1</button><br>
<button id="button2">click Me 2</button><br>
<button id="button3">click Me 3</button><br>
<button id="button4">click Me 4</button><br>
<button id="button5">click Me 5</button><br>
</body>
测试js文件
$(function(){
$("#button1").click(function(){
$.Zebra_Dialog('<strong>Zebra_Dialog</strong>' + '可以加入html的提示框');
});
$("#button2").click(function(){
$.Zebra_Dialog( '<strong>Zebra_Dialog</strong> 可以设置标题和Dialog类型',
{
'type': 'error',
'title': 'Error'
}
);
});
$("#button3").click(function(){
$.Zebra_Dialog('<strong>Zebra_Dialog</strong>',
{
'type': 'question',
'title': 'Custom buttons',
'buttons': ['Yes', 'No', 'Help'],
'onClose': function(caption) {
alert("刚刚选择的是" + caption);
}
}
);
});
$("#button4").click(function(){
$.Zebra_Dialog('<strong>Zebra_Dialog</strong>',
{
'title': 'Custom positioning',
'position': ['right - 20', 'top + 20']
}
);
});
$("#button5").click(function(){
new $.Zebra_Dialog('<strong>Zebra_Dialog</strong> 2秒后自动消失',
{
'buttons': false,
'modal': false,
'position': ['right - 20', 'top + 20'],
'auto_close': 2000
}
);
});
});
配置的参数如下(来源于官网):
Configuration
All parameters are optional.
animation_speed integer
The speed, in milliseconds, by which the overlay and the dialog box will be animated when closing.
Default is 250
auto_close mixed
The number of milliseconds after which to automatically close the dialog box or FALSE to not automatically close the dialog box.
Default is FALSE.
buttons mixed
Use this for localization and for adding custom buttons.
If set to TRUE, the default buttons will be used, depending on the type of the dialog box: ['Yes', 'No'] for “question” type and ['Ok'] for the other dialog box types.
For custom buttons, use an array containing the captions of the buttons to display: ['My button 1', 'My button 2'].
Set to FALSE if you want no buttons.
Note that when the dialog box is closed as a result of clicking a button, the “onClose” event is triggered and the callback function (if any) receives as argument the caption of the clicked button.
See the comments for the “onClose” event below for more information.
vcenter_short_message boolean
Should short messages be vertically centered?
Default is TRUE.
keyboard boolean
When set to TRUE, pressing the ESC key will close the dialog box.
Default is TRUE.
message string
The message in the dialog box – this is passed as argument when the plugin is called.
modal boolean
When set to TRUE there will be a semitransparent overlay behind the dialog box, preventing users from clicking the page’s content.
Default is TRUE.
overlay_close boolean
Should the dialog box close when the overlay is clicked?
Default is TRUE.
overlay_opacity double
The opacity of the overlay (between 0 and 1)
Default is .9
position mixed
Position of the dialog box.
Can be either “center” (which would center the dialog box) or an array with 2 elements, in the form of ['horizontal_position +/- offset', 'vertical_position +/- offset'] (notice how everything is enclosed in quotes) where “horizontal_position” can be “left”, “right” or “center”, “vertical_position” can be “top”, “bottom” or “middle”, and “offset” represents an optional number of pixels to add/substract from the respective horizontal or vertical position.
Positions are relative to the viewport (the area of the browser that is visible to the user)!
Examples:
['left + 20', 'top + 20'] would position the dialog box in the top-left corner, shifted 20 pixels inside.
['right - 20', 'bottom - 20'] would position the dialog box in the bottom-right corner, shifted 20 pixels inside.
['center', 'top + 20'] would position the dialog box in center-top, shifted 20 pixels down.
Default is ['center', 'middle']
title string
Title of the dialog box
Default is “” (an empty string – no title)
type mixed
Dialog box type.
Can be any of the following:
- confirmation
- error
- information
- question
- warning
If you don’t want an icon, set the “type” property to FALSE.
By default, all types except “question” have a single button with the caption “Ok”; type “question” has two buttons, with the captions “Ok” and “Cancel” respectively.
Default is “information”.
width integer
Width of the dialog box
By default, the width of the dialog box is set in the CSS file. Use this property to override the default width at run-time.
Must be an integer, greater than 0. Anything else will instruct the script to use the default value, as set in the CSS file. Value should be no less than 200 for optimal output.
Default is 0 – use the value from the CSS file.
Events
onClose
Event fired when the dialog box is closed.
The callback function (if any) receives as argument the caption of the clicked button or boolean FALSE if the dialog box is closed by pressing the ESC key or by clicking on the overlay.
Public methods
close
Call this method to manually close the dialog box.
Must be called like $(element).data(‘Zebra_Dialog’).close()
下面带上测试的包html 和必须的js css文件
分享到:
相关推荐
当我们谈论“Jquery自带的弹出框效果”时,实际上是指jQuery UI中的几个对话框组件,如`dialog()`函数。这些弹出框不仅提供了基本的提示功能,还能实现复杂的交互式窗口,为用户界面添加丰富的用户体验。 1. **...
本主题聚焦于利用CSS3动画过渡效果和jQuery库创建动态弹出框插件。这种结合使得弹出框不仅功能强大,还能提供平滑、吸引人的视觉体验。 首先,让我们了解CSS3中的动画和过渡。CSS3的`transition`属性允许我们在更改...
在网页开发中,jQuery是一个非常流行的JavaScript库,它极大地简化了DOM操作、事件处理和动画效果...在实际项目中,还可以结合其他插件如Bootstrap的Modal组件,或自定义jQuery插件,进一步提升弹出框的灵活性和功能。
总之,jQuery弹出框是网页交互中的重要组成部分,通过理解基本的JavaScript对话框、自定义模态窗口的创建以及利用jQuery插件,我们可以创建出丰富多样的弹出框效果,提高用户体验。实践中的关键是根据项目需求灵活...
遮罩弹出框则在此基础上添加了一个半透明的背景层(通常称为“遮罩”),这不仅能够聚焦用户的注意力,还能提供更好的用户体验,避免用户在弹出框显示时误触页面其他元素。 1. **基本遮罩弹出框** 最基础的遮罩弹...
1. `jquery.messager.js`:这是一个扩展jQuery功能的插件,实现了弹出框的逻辑。它可能包含了弹出层的创建、显示、位置调整、大小设置、关闭功能及遮罩效果的实现。通常,这样的插件会提供一系列的API供开发者调用,...
在网页开发中,jQuery弹出框插件是增强用户体验、展示信息或进行交互的重要工具。这些插件使得创建对话框、提示框、警告框、模态框等变得更加简单。以下是对给定标题和描述中涉及的jQuery弹出框插件的详细解释: 1....
本篇文章将深入探讨“弹出框插件”,特别是基于jQuery的alert弹出框插件,它以其美观性和易用性而受到开发者的欢迎。 首先,我们要理解什么是弹出框。在Web开发中,弹出框通常是网页内容之外独立显示的小窗口,用于...
而“jQuery弹出框插件”则是基于jQuery库开发的一类扩展,用于创建各种类型的对话框或提示框,如警告、确认、信息提示以及模态窗口等。这些插件通常具有高度自定义性,能够帮助开发者快速实现用户界面的互动功能,...
**基于jQuery的弹出框插件** 在网页开发中,弹出框是一种常见的交互元素,用于展示信息、警告、确认操作或收集用户输入。jQuery,作为一款强大的JavaScript库,简化了DOM操作,使得创建自定义弹出框插件变得更加...
jQuery Dialog 是一个功能强大的弹出框插件,它是 jQuery UI 库的一部分,广泛应用于网页交互设计中,提供美观且可自定义的对话框效果。在实际项目中,它以其高效和易用性受到开发者的喜爱。 Dialog 弹出框的核心...
jquery图片弹出框插件 jquery图片排序过滤 jquery图片放大 jquery图片滑动效果 jquery城市二级联动 jquery多值输入插件 jquery多级菜单导航 jquery大转盘game jquery实现网易邮箱首页插件 jquery导航,缓慢弹出下拉...
jQuery弹出框美化插件是一种增强网页交互体验的工具,主要目标是替换JavaScript原生的alert和confirm函数,提供更加美观、自定义化的提示信息窗口。这种插件通常包含丰富的样式和功能,允许开发者根据需求调整弹出框...
本文将详细介绍jQuery插件"jquery.reveal",它可以帮助我们轻松实现具有遮罩效果的弹出框,为用户提供更加友好的交互体验。 一、jQuery.reveal 插件介绍 "jquery.reveal"是一款基于jQuery的弹出层插件,通过简单的...
jQuery弹出框插件是一种基于JavaScript库jQuery设计的交互式用户界面组件,它主要用于在网页上创建各种形式的弹出对话框。这些弹出层通常用于显示信息提示、警告、确认对话框,甚至用于创建模态窗口,以增强用户体验...
在网页开发中,jQuery弹出框插件是增强用户体验、展示信息或获取用户输入的常用工具。本篇文章将深入探讨“超赞的Jquery弹出框插件”,它支持IE6及以上的浏览器,并且提供了丰富的提示样式,允许开发者进行自定义,...
此外,jQuery还有许多插件可以帮助创建更复杂的弹出框效果,如jQuery UI的Dialog组件,或者Bootstrap的Modal插件。这些插件提供了丰富的选项和预设样式,可以轻松定制弹出框的外观和行为。 总的来说,创建一个弹出...
9. **插件集成(Plugin Integration)**:虽然可以手动实现上述功能,但已有许多成熟的jQuery插件,如jQuery UI Dialog、Fancybox和当然还有Lightbox本身,可以直接集成到项目中,快速创建功能丰富的弹出框。...