jquery插件jquery.confirm彈出確認(rèn)消息
本文為大家介紹了插件jquery.confirm彈出確認(rèn)消息的實(shí)現(xiàn)方法,具有一定的參考價(jià)值,特分享給大家供大家參考,具體內(nèi)容如下
實(shí)現(xiàn)效果:

具體代碼:
1、插件默認(rèn)參數(shù)
// 默認(rèn)參數(shù)
$.confirm.defaults = {
// 樣式
css: "http://static.qianduanblog.com/css/jquery.confirm/default.min.css?v=" + Math.ceil(new Date() / 86400000),
// 確認(rèn)框內(nèi)容
content: "確認(rèn)嗎?",
// 確認(rèn)按鈕文字
sureButton: "確認(rèn)",
// 取消按鈕文字
cancelButton: "取消",
// 位置
position: {},
// 自動(dòng)打開
autoOpen: false,
// 動(dòng)畫持續(xù)時(shí)間
duration: 123,
// 打開確認(rèn)框回調(diào)
onopen: emptyFn,
// 單擊了確認(rèn)或者取消回調(diào)
onclick: emptyFn,
// 確認(rèn)回調(diào)
onsure: emptyFn,
// 取消回調(diào)
oncancel: emptyFn,
// 關(guān)閉確認(rèn)框回調(diào)
onclose: emptyFn
}
2、插件結(jié)構(gòu)與樣式
jquery.confirm的dom結(jié)構(gòu)為:
<div class="jquery_confirm____" style="display:none"> <div class="jquery_confirm____body">確認(rèn)框消息</div> <div class="jquery_confirm____footer"> <button class="button button-primary jquery_confirm____sure">確認(rèn)</button> <button class="button button-error jquery_confirm____cancel">取消</button> </div> </div>
默認(rèn)的插件樣式基于css.3,默認(rèn)的插件樣式地址為default,插件樣式只渲染一次,不會(huì)多次渲染,以第一次使用插件的樣式為準(zhǔn)。
3、使用方法
// 打開確認(rèn)框
$.confirm({
content: "確認(rèn)要查看嗎?",
onopen: function() {
alert("確認(rèn)框打開了!");
},
onclose: function() {
alert("確認(rèn)框關(guān)閉了!");
},
onsure: function() {
alert("你單擊了確認(rèn)按鈕!");
},
oncancel: function() {
alert("你單擊了取消按鈕!");
},
onclick: function(s) {
if (s) {
alert("你單擊了確認(rèn)按鈕!");
} else {
alert("你單擊了取消按鈕!");
}
}
});
$.confirm("確認(rèn)嗎?", function(s) {
if (s) {
alert("你單擊了確認(rèn)按鈕!");
} else {
alert("你單擊了取消按鈕!");
}
});
希望本文所述對(duì)大家學(xué)習(xí)jquery程序設(shè)計(jì)有所幫助。
- JQuery的Alert消息框插件使用介紹
- 基于jQuery的message插件實(shí)現(xiàn)右下角彈出消息框
- 基于JQuery 的消息提示框效果代碼
- jquery判斷瀏覽器后退時(shí)候彈出消息的方法
- 使用ASP.NET MVC 4 Async Action+jQuery實(shí)現(xiàn)消息通知機(jī)制的實(shí)現(xiàn)代碼
- Notify - 基于jquery的消息通知插件
- jQuery實(shí)現(xiàn)鼠標(biāo)移到元素上動(dòng)態(tài)提示消息框效果
- 基于jQuery的彈出消息插件 DivAlert之旅(一)
- 讓新消息在網(wǎng)頁標(biāo)題閃爍提示的jQuery代碼
- jquery自定義顯示消息數(shù)量
相關(guān)文章
JavaScript實(shí)現(xiàn)點(diǎn)擊改變圖片形狀(transform應(yīng)用)
這篇文章主要為大家詳細(xì)介紹了JavaScript實(shí)現(xiàn)點(diǎn)擊改變圖片形狀,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-04-04
微信小程序?qū)崿F(xiàn)點(diǎn)贊業(yè)務(wù)
這篇文章主要為大家詳細(xì)介紹了微信小程序?qū)崿F(xiàn)點(diǎn)贊業(yè)務(wù),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-02-02
JavaScript之事件委托實(shí)例(附原生js和jQuery代碼)
下面小編就為大家?guī)硪黄狫avaScript之事件委托實(shí)例(附原生js和jQuery代碼)。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-07-07
微信小程序?qū)崿F(xiàn)點(diǎn)餐小程序左側(cè)滑動(dòng)菜單
這篇文章主要為大家詳細(xì)介紹了微信小程序?qū)崿F(xiàn)點(diǎn)餐小程序左側(cè)滑動(dòng)菜單,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-07-07
javascript實(shí)現(xiàn)的listview效果
javascript實(shí)現(xiàn)的listview效果...2007-04-04

