【整理】最佳jQuery窗口插件(Modal Dialog Plugins)

在Ajax中经常用到的弹出窗口和遮蔽窗口。

Boxy
Boxy是一个灵活的、Facebook-style对话框,为jQuery支持并拖拽tweening大小。它不同于其他叠我见过提供一个对象的接口来控制对话之后,他们已经创造了。操作简单,boxy场景,还提供了一个jQuery插件为自动猎艳链接和形式,以及一个问()帮助呈现多元化选择的用户。
---------------------------------------------------------------------
官方网址:http://onehackoranother.com/projects/jquery/boxy/
相关支持:
  • 图片文字:
  • 相册Rel:
  • 内联支持:
  • Iframe支持:
  • Modal支持:
  • 可定制性:
---------------------------------------------------------------------
官方效果图如下:


自定义效果图如下:

插件支持国际化:
【转载】来自: http://seanhe.iteye.com/blog/407955
今天比较了几个jquery dialog的plugin并且看了一些网上的评论,最终决定使用boxy http://onehackoranother.com/projects/jquery/boxy/。 但是在使用的过程中发现Boxy.confirm和Boxy.alert的按钮的文案是无法修改的。就这一点感觉这个插件稍微有一点欠缺,其实对于 confirm和alert着两个WINDOW上按钮也应该没有什么特殊的需求,在中国无非是“确认”、“取消”,对于老外无非 是"ok"、"cancel",所以我就想着让这个插件支持国际化。
在JS中进行国际化的支持我参考了rapid-validation http://code.google.com/p/rapid-validation/
新增了I18nUtils
I18nUtils = {
getLanguage : function() {
var lang = null;
if (typeof navigator.userLanguage == 'undefined')
lang = navigator.language.toLowerCase();
else
lang = navigator.userLanguage.toLowerCase();
return lang;
},
getMessageSource : function() {
var lang = I18nUtils.getLanguage();
var messageSource = Boxy.messageSource['zh-cn'];
if(Boxy.messageSource[lang]) {
messageSource = Boxy.messageSource[lang];
}
return messageSource;
},
getMessage:function(key){
var messageSource=I18nUtils.getMessageSource();
return messageSource[key];
}
}
增加国际化消息的定义
Boxy.messageSource={};
Boxy.messageSource['en-us']={
confirmBtn:{'true':'OK','false':'Cancel'},
alertBtn:{'true':'OK'}
}
Boxy.messageSource['zh-cn']={
confirmBtn:{'true':'确定','false':'取消'},
alertBtn:{'true':'确定'}
}

Boxy.messageSource['en']=Boxy.messageSource['en-us'];
修改Boxy.confirm和Boxy.alert的源代码
     // displays an alert box with a given message, calling optional callback
// after dismissal.
alert: function(message, callback, options) {
var i18nMsg=I18nUtils.getMessage('alertBtn');
return Boxy.ask(message, i18nMsg, callback, options);
},

// displays an alert box with a given message, calling after callback iff
// user selects OK.
confirm: function(message, after, options) {
var i18nMsg=I18nUtils.getMessage('confirmBtn');
return Boxy.ask(message,i18nMsg, function(response) {
if (response == 'true') after();
}, options);
},
经过这个修改使用Boxy.confirm当用户点击了“确定”或者"OK"后都会回调外部方法。当使用Boxy.alert时用户点击了“确定”或者"OK"返回给回调函数的值都是'true'修改后的js代码见附件

插件使用:
【可参考:】
【jQuery boxy弹出层插件中文演示及讲解】http://www.zhangxinxu.com/study/200911/jQuery-plugin-boxy.html
-------------------------------------------------------------------------------------------------------
表单使用:
$(function(){
$(".userEdit").each(function(){
$(this).click(function(){
var editId = $(this).parent().attr("id").replace($(this).attr("class"),"");
var editValue = $("#userName"+editId).html();
var editHTML = "<div><div class='question' id='editQues'>用户名:<input id='boxyNameEdit' type='text' value='"+editValue+"' /></div><form class='answers'><input type='button' value='确认' class='boxy-btn1' /> <input type='button' value='取消' class='boxy-btn2' /></form></div>";
var editBoxy = new Boxy(editHTML,{title:"修改用户名",modal:true,closeable:false,unloadOnHide:true });
$(".boxy-btn2").click(function(){
editBoxy.hide();         
});
$(".boxy-btn1").click(function(){
var nowValue = $("#boxyNameEdit").val();
$(this).attr("disable","disabled");
$("#editQues").html("正在发送请求……");
$.ajax({
url:"edit_user.php",
type:"GET",
data:{userID:editId,userName:nowValue},
timeout:20000,
success:function(data){
if(data === "sucess"){
$("#editQues").html("修改成功!");
$("#editDelForm").submit();
editBoxy.hide();
}else{
$("#editQues").html("由于某些原因,修改失败,您可以试试刷新重试!");
}
},
error:function(){
$("#editQues").html("由于某些原因,修改出现错误,您可以刷新重试!");
}
});

});
return false;       
});       
});
---------------------------------------------------------------------------------

SimpleModal – Lightweight jQuery Modal Dialog

概述:   
SimpleModal是一个轻量级的jQuery的插件,它提供了一个模式对话框发展的强大界面。 你可以把它作为一个模式对话框的框架。 SimpleModal让您灵活构建不管你可以设想,而屏蔽你从相关的跨浏览器问题与用户界面发展的内在。
官方地址:
      http://www.ericmmartin.com/projects/simplemodal/
相关支持:

效果图片:

Facebox
Facebox有一个jQuery是基础,脸谱式灯箱,可以显示图像,div的,或整个远程页面。
--------------------------------------------------------------------
官方网址:
http://famspam.com/facebox
相关支持:

-------------------------------------------------------------------
图片效果:
jqModal
jqModal is a plugin for jQuery to help you display notices, dialogs, and modal windows in a web browser. It is flexible and tiny, akin to a "Swiss Army Knife", and makes a great base as a general purpose windowing framework.
---------------------------------------------------------------
官方地址:http://dev.iceburg.net/jquery/jqModal/#who
相关支持:

---------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------

jQuery UI Dialog
The jQuery UI framework offers up a functional Dialog widget that allows resizing and also the ability to display forms. The basic dialog window is an overlay positioned within the viewport and is protected from page content (like select elements) shining through with an iframe. It has a title bar and a content area, and can be moved, resized and closed with the ‘x’ icon by default.
效果图:


----------------------------------------------------------------------------------------------------------

jQuery BlockUI Plugin
The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. When activated, it will prevent user activity with the page (or part of the page) until it is deactivated. BlockUI adds elements to the DOM to give it both the appearance and behavior of blocking user interaction.

jQuery Impromptu
jQuery Impromptu is an extension to help provide a more pleasant way to spontaneously prompt a user for input. More or less this is a great replacement for an alert, prompt, and confirm. Not only does it replace these but it also allows for creating forms within these controls. This is not intended to be a modal replacement, just a quick tool to prompt user input in a fashionable way.

jQuery Alert Dialogs (Alert, Confirm & Prompt Replacements)
This jQuery plugin aims to replace the basic functionality provided by the standard JavaScript alert(), confirm(), and prompt() functions. What’s the benefit of using custom methods? These are completely customizable via CSS. You can set a custom title for each dialog. IE7 users get an ugly warning and usually have to reload the page if you use a regular prompt(). These methods simulate a true modal dialog box. They will automatically re-position themselves if you resize the browser window (unlike many existing dialog/lightbox-style plugins). If you include the jQuery UI Draggable plugin, the dialogs can be moved by dragging their title bars.

How to Create a Stunning and Smooth Popup Using jQuery
Nowadays, websites are more and more rich and interactive and users are becoming more and more critical with all things in websites. Using windows popup to show important information are in the air and We are going to learn how to create a stunning and great window popup from the scratch using jQuery in a simple and clean tutorial.

jQuery Ajax Validation Contact Form with Modal + Slide-in Transition
Due to popular demand, here is a tutorial on how I created one of the more complicated pieces of machinery on my new site: the contact form. All you need is jQuery. No plugins are necessary for this to work, and it is only 2kb of extra code in addition to the jQuery library. This also works on all browsers, IE6 and up.

Creating an Exit Modal Box using jQuery
Do you need to show a specific message to the visitors that leave your website? You can do that by initiating a modal box before they close the browser window. To do this we need to include 2 JQuery files (the actual library and a plugin written by Eric Martin), the modal box’s CSS and the file that triggers the modal box based on the user’s action.

Upload in Modal Window and Pass Values with jQuery
Do you publish your blogs with Wordpress? If yes, you know the inline popup window which opens if you like to upload / insert an image into your article. This tutorial shows you how-to use the jQuery Plugin ThickBox and some jQuery code to upload a file and pass a value to the parent page. You can use this kind of feature in your custom CMS or maybe you like use it as a basic for your own file upload plugin or gadget?

jQuery Modal Choose Component
This original article is written in Italian, but here is the translated English version. I wanted to be sure and include this in the rundown because it gives another option on how to allow users to choose values for a form field. It’s designed as an alternative to the combo box, or select dropdown menu. It’s not perfect, but it’s an interesting take on a common UI component and I believe deserves to be on the list.

---------------------------------------------------------------------------------

JQuery Modal Choose Component 效果图片:

---------------------------------------------------------------------------------

jQuery Modal Dialog Plugin
This plugin link goes to the working example and documenation page that shows off some real nice jQuery modal dialogs for errors, warnings, prompts and more. Getting to the download is a little tricky unless you follow this link to download.

jQuery.chatbox 说明文档 特性 1.轻量级动画特效以及友好的界面 2.支持多窗口 3.完善的回调函数以实现自定义功能 4.多种调用方式 4.良好的封装以及扩展性 5.每个聊天窗对象实例以data属性的形式附加在聊天窗DOM对象上(如果你想获得某个特定插件的实例,可以直接从页面元素中获取:$('{boxId}').data('chatbox')) 配置项 配置项分为全局配置项和实例配置项 全局配置项: 参数            类型           默认值                说明 ----------------------------------------------------------------------------------------------- id              number          null                  当前用户的id,也就是发送者的id,必须是唯一值 user            string          null                  发送者的显示名称,可以是昵称用户名等,不要求唯一 debug           boolean         false                 是否打开调试功能 idPrefix        string          'chatbox_'            生成页面DOM元素的id值 实例配置项: 参数            类型           默认值                说明 ----------------------------------------------------------------------------------------------- id              number          null                  接收者的id,同时也会作为实例id,必须是唯一值 user            string          null                  接收者的显示名称,可以是昵称用户名等,不要求唯一 title           string          'Chat with ' {user}   聊天窗的标题 回调函数 回调函数也分为两种,一种是全局回调函数另一种是实例回调函数。 但是有点Javascript基础的开发者应该了解不管是哪种类型的回调函数我们都应该以传递函数引用的方式来调用,而不是对每个实例创建一个函数副本。 这样会造成内存浪费。全局回调函数不会在实例化每个聊天窗对象时重复创建副本分配给每个对象实例,而实例回调函数会。 因此在不需要为每个独立的聊天窗分配不同的回调功能时使用实例回调函数也应该以传递函数引用的方式来分配回调函数以节省内存空间。 回调函数参考: 函数名                  参数       说明 ----------------------------------------------------------------------------------------------- onChatboxCreate                     创建聊天窗时触发 onChatboxEnable                     聊天窗被启用时触发 onChatboxDisable                    聊天窗被禁用时触发 onMessageSend           msg         发送消息时触发,唯一参数:消息内容msg onMessageReceive        msg         收到消息时触发,唯一参数:消息内容msg onMessageSystem         msg         收到系统消息时触发,唯一参数:消息内容msg onChatboxDestroy                    销毁聊天窗时触发 优先级:实例回调函数优先级高于全局回调函数,也就是说实例配置项中的回调函数会覆盖全局配置项中同名的回调函数。 this指针:this指针经由apply或者call方法已经指向调用该方法的实例。 API(属性和方法) 全局API: 属性/方法名       类型       参数          说明 ----------------------------------------------------------------------------------------------- globalOptions     属性        无           保存所有聊天窗的全局配置项 getQueue()        方法        无           返回当前聊天窗的实例队列 实例API: 属性/方法名       类型      参数              说明 ----------------------------------------------------------------------------------------------- $elem             属性        无              保存着当前聊天窗实例的jQuery对象 opts              属性        无              保存着当前聊天窗实例的初始化选项 show()            方法        无              显示聊天窗 hide()            方法        无              隐藏聊天窗 enable()          方法        无              启用聊天窗 disable()         方法        无              禁用聊天窗 message()         方法        msg,type        设置接收到的消息到聊天窗,两个参数:消息内容msg、消息类型type blink()           方法        无              高亮标题栏闪烁提示 destroy()         方法        无              无 调用方式 设定全局配置项: 直接定义配置对象globalOptions,未给定的配置项依旧会使用默认值并不会被该配置对象覆盖 $.chatbox.globalOptions = {     id:10000,     user:'Jason',     debug:true,     onChatboxCreate:function(){         //要执行的代码     } } 或者以附加属性的方式 $.chatbox.globalOptions.id = 10000; $.chatbox.globalOptions.user = 'Jason'; $.chatbox.globalOptions.onChatboxCreate = function(){     //要执行的代码 }; 初始化聊天窗: $.chatbox({     id:11254,     user:'Tony',     title:'Chat with Tony',     onChatboxCreate:function(){         //要执行的代码     } }); 调用API方法: 第一种调用方式 $.chatbox({instanceId}).message({message content}); 第二种调用方式 $({boxId}).data('chatbox').message({message content}); 标签:Chatbox
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值