jquery外掛程式jquery.confirm彈出確認訊息,

來源:互聯網
上載者:User

jquery外掛程式jquery.confirm彈出確認訊息,

本文為大家介紹了外掛程式jquery.confirm彈出確認訊息的實現方法,具有一定的參考價值,特分享給大家供大家參考,具體內容如下

實現效果:

具體代碼:

1、外掛程式預設參數

// 預設參數$.confirm.defaults = { // 樣式 css: "http://static.qianduanblog.com/css/jquery.confirm/default.min.css?v=" + Math.ceil(new Date() / 86400000), // 確認框內容 content: "確認嗎?", // 確認按鈕文字 sureButton: "確認", // 取消按鈕文字 cancelButton: "取消", // 位置 position: {}, // 自動開啟 autoOpen: false, // 動畫期間 duration: 123, // 開啟確認框回調 onopen: emptyFn, // 單擊了確認或者取消回調 onclick: emptyFn, // 確認回調 onsure: emptyFn, // 取消回調 oncancel: emptyFn, // 關閉確認框回調 onclose: emptyFn}

2、外掛程式結構與樣式
jquery.confirm的dom結構為:

<div class="jquery_confirm____" style="display:none"> <div class="jquery_confirm____body">確認框訊息</div> <div class="jquery_confirm____footer">  <button class="button button-primary jquery_confirm____sure">確認</button>  <button class="button button-error jquery_confirm____cancel">取消</button> </div></div>

預設的外掛程式樣式基於css.3,預設的外掛程式樣式地址為default,外掛程式樣式只渲染一次,不會多次渲染,以第一次使用外掛程式的樣式為準。

3、使用方法

// 開啟確認框$.confirm({ content: "確認要查看嗎?", onopen: function() {  alert("確認框開啟了!"); }, onclose: function() {  alert("確認框關閉了!"); }, onsure: function() {  alert("你單擊了確認按鈕!"); }, oncancel: function() {  alert("你單擊了取消按鈕!"); }, onclick: function(s) {  if (s) {   alert("你單擊了確認按鈕!");  } else {   alert("你單擊了取消按鈕!");  } }}); $.confirm("確認嗎?", function(s) { if (s) {  alert("你單擊了確認按鈕!"); } else {  alert("你單擊了取消按鈕!"); }});

希望本文所述對大家學習jquery程式設計有所協助。

您可能感興趣的文章:
  • 基於jQuery的彈出訊息外掛程式 DivAlert之旅(一)
  • 基於jQuery的message外掛程式實現右下角彈出訊息框
  • 利用JQuery製作符合Web標準的QQ彈出訊息
  • jquery判斷瀏覽器後退時候彈出訊息的方法
  • jquery製作漂亮的彈出層提示訊息特效

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.