iOS Style Alert And Confirm Dialog Plugin alert confirm js - Download iOS-Style Alert And Confirm Dialog Plugin - alert-confirm.js

Download iOS-Style Alert And Confirm Dialog Plugin – alert-confirm.js

Posted on

This time I will share jQuery Plugin and tutorial about iOS-Style Alert And Confirm Dialog Plugin – alert-confirm.js, hope it will help you in programming stack.

iOS Style Alert And Confirm Dialog Plugin alert confirm js - Download iOS-Style Alert And Confirm Dialog Plugin - alert-confirm.js
File Size: 8.69 KB
Views Total: 3120
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

alert-confirm.js is a lightweight jQuery plugin that helps you create customizable, iOS-style, mobile-friendly alert or confirmation dialog boxes on the webpage. Can be used as an advanced alternative to the native JavaScript popup boxes.

How to use it:

1. To get started, make sure you load the following JS & CSS files correctly in the html page.

1 <script src="//code.jquery.com/jquery-3.0.0.min.js"></script>
2 <script src="src/alert-confirm.js"></script>
3 <link rel="stylesheet" href="src/alert-confirm.css">

2. Create an alert dialog using $.alert() function.

1 $.alert('Alert Message', {
2   // options here
3 });

3. Create a confirmation dialog using $.confirm() function.

1 $.confirm('Confirm Message', {
2   // options here
3 });

4. You can also create custom alert or confirmation dialog boxes using alertconfirm method.

01 <div class="ms-alert hidden">
02   <div class="ms-alert-body">
03     <div class="ms-alert-header">header</div>
04     <div class="ms-alert-content">content</div>
05     <div class="ms-alert-buttons">
06       <div class="ms-alert-button confirm">confirm</div>
07       <div class="ms-alert-button cancel">cancel</div>
08     </div>
09   </div>
10 </div>
01 $('.ms-alert').alertconfirm({
02   showFunction: function () {
03     this.removeClass('hidden')
04   },
05   hideFunction: function () {
06     this.addClass('hidden')
07   }
08 })
09  
10 $('#trigger-element').on('click', function () {
11   $('.ms-alert').alertconfirm('show')
12 })

5. Default options available.

1 header: 'Title',
2 content: ' ',
3 confirmButtonText: 'Okey',
4 cancelButtonText: 'Cancel',
5 confirm: noop, // callback
6 cancel: noop // callback

6. Events.

  • ‘show.ms.alert’
  • ‘shown.ms.alert’
  • ‘hide.ms.alert’
  • ‘hidden.ms.alert’
  • ‘confirm.ms.alert’
  • ‘cancel.ms.alert’
1 $(selector).on(eventName)

This awesome jQuery plugin is developed by minesaner. For more Advanced Usages, please check the demo page or visit the official website.

source : jqueryscript.net