forked from craftpip/jquery-confirm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
2205 lines (2147 loc) · 117 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<!-- <meta http-equiv="X-UA-Compatible" content="chrome=1"> -->
<title>jquery-confirm.js | The multipurpose alert & confirm</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<meta name="description" content="A multipurpose alert, confirm plugin, alternative to the native alert() and confirm() functions. Supports features like auto-close, themes, animations, and more.">
<link rel="canonical" href="https://craftpip.github.io/jquery-confirm" />
<link rel="icon" type="img/ico" href="http://craftpip.com/i/apple-touch-icon-57x57.png">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="robots" content="index,follow,noodp,noydir"/>
<meta name="google-site-verification" content="T_M_Ym5DQ-cEQQhx_jswyCBTssIdgtewICcvb3sgh8g" />
<meta name="Keywords" content="jquery.confirm, jquery confirm, jquery alert, jquery prompt, jquery dialog, javascript, bootstrap" />
<link rel="apple-touch-icon" sizes="57x57" href="http://craftpip.com/i/apple-touch-icon-57x57.png" />
<link rel="apple-touch-icon" sizes="72x72" href="http://craftpip.com/i/apple-touch-icon-72x72.png" />
<link rel="apple-touch-icon" sizes="114x114" href="http://craftpip.com/i/apple-touch-icon-114x114.png" />
<link rel="apple-touch-icon" sizes="144x144" href="http://craftpip.com/i/apple-touch-icon-144x144.png" />
<link rel="apple-touch-icon" href="http://craftpip.com/i/apple-touch-icon-57x57.png" />
<meta property="og:title" content="jquery-confirm.js | The multipurpose alert & confirm" />
<meta property="og:type" content="website" />
<meta property="og:image" content="http://craftpip.com/i/apple-touch-icon-57x57.png" />
<meta property="og:url" content="https://craftpip.github.io/jquery-confirm" />
<meta property="og:description" content="A multipurpose alert & confirm plugin, alternative to the native alert() and confirm() functions. Supports features like auto-close, themes, animations, and more." />
<meta property="og:site_name" content="craftpip.github.io" />
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.sticky/1.0.3/jquery.sticky.min.js"></script>
<link rel="stylesheet" href="demo/libs/default.min.css">
<script src="demo/libs/pretty.js"></script>
<link rel="stylesheet" href="demo/demo.min.css">
<script>
var version = '2.5.0';
</script>
<style type="text/css">
.space10{
height: 10px;
}
body{
font-family: Segoe UI,Frutiger,Frutiger Linotype,Dejavu Sans,Helvetica Neue,Arial,sans-serif;
position: relative;
}
</style>
<!-- Add the minified version of files from the /dist/ folder. -->
<!-- jquery-confirm files -->
<link rel="stylesheet" type="text/css" href="css/jquery-confirm.css" />
<script type="text/javascript" src="js/jquery-confirm.js"></script>
<!--END jquery-confirm files-->
</head>
<body data-spy="scroll" data-target=".navbar">
<header class="navbar navbar-static-top navbar-default navheader">
<div class="container">
<div class="navbar-header">
<button class="navbar-toggle collapsed"
type="button"
data-toggle="collapse"
data-target="#bs-navbar"
aria-controls="bs-navbar"
aria-expanded="false"><span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span></button>
<!--<a href="/"-->
<!--class="navbar-brand">Jquery-confirm</a>-->
<a class="navbar-brand" href="http://craftpip.github.io"><span class="craftpip-logo"></span></a>
</div>
<nav id="bs-navbar"
class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class=""><a href="http://github.com/craftpip/jquery-confirm"><i class="fa fa-github"></i> Project home</a></li>
<li class=""><a href="http://github.com/craftpip/jquery-confirm/issues/new">Suggest feature</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Versions <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="http://craftpip.github.io/jquery-confirm/v2.0">v2.0</a></li>
<li><a href="http://craftpip.github.io/jquery-confirm/v1.8">v1.8</a></li>
<li><a href="http://craftpip.github.io/jquery-confirm/v1.7.9">v1.7.9</a></li>
<li><a href="http://craftpip.github.io/jquery-confirm/v1.7.8">v1.7.8</a></li>
<li><a href="http://craftpip.github.io/jquery-confirm/v1.7.5">v1.7.5</a></li>
<li><a href="http://craftpip.github.io/jquery-confirm/v1.7.3">v1.7.3</a></li>
<li><a href="http://craftpip.github.io/jquery-confirm/v1.7">v1.7</a></li>
<li><a href="http://craftpip.github.io/jquery-confirm/v1.6">v1.6</a></li>
<li><a href="http://craftpip.github.io/jquery-confirm/v1.5.3">v1.5.3</a></li>
<li><a href="http://craftpip.github.io/jquery-confirm/v1.5.1">v1.5.1</a></li>
<li><a href="http://craftpip.github.io/jquery-confirm/v1.5">v1.5</a></li>
<li><a href="http://craftpip.github.io/jquery-confirm/v1.1.3">v1.1.3</a></li>
<li><a href="http://craftpip.github.io/jquery-confirm/v1.1">v1.1</a></li>
<li><a href="http://craftpip.github.io/jquery-confirm/v1.0">v1.0</a></li>
</ul>
</li>
<li>
<a class="github-button" href="https://github.com/craftpip/jquery-confirm" data-style="mega" data-count-href="/craftpip/jquery-confirm/stargazers" data-count-api="/repos/craftpip/jquery-confirm#stargazers_count" data-count-aria-label="# stargazers on GitHub" aria-label="Star craftpip/jquery-confirm on GitHub">Star</a>
</li>
<li>
<a class="twitter-follow-button" data-show-count="false" data-size="large" href="https://twitter.com/craftpip" data-show-count="false" data-lang="en">
Follow @craftpip
</a>
</li>
</ul>
</nav>
</div>
</header>
<div class="header"
id="content"
tabindex="-1">
<div class="container">
<h1 style="margin-top: 7px;" class="text-center">
<img style="width: 400px;" src="jquery-confirm.png" alt="JQUERY-CONFIRM"/>
</h1>
<p>
<em>alerts</em>, <em>confirms</em> and <em>dialogs</em> in <strong>one</strong>.
</p>
</div>
</div>
<!--<div style="height:50px"></div>-->
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-12">
<div class="space10"></div>
<div class="space10"></div>
<p>
<strong>jquery-confirm v<span class="version"></span> docs</strong><br>
<a href="https://github.com/craftpip/jquery-confirm">
view on <i class="fa fa-github"></i> Github
</a>
</p>
<a href="https://github.com/craftpip/jquery-confirm/zipball/master" class="btn btn-download btn-lg btn-block">
Download latest
</a>
<a href="https://github.com/craftpip/jquery-confirm/releases" class="btn btn-download btn-block">
View all releases
</a>
<div class="spacer15"></div>
<p class="text-right">
<code>version <span class="version"></span></code>
</p>
<div class="spacer15"></div>
<div id="my-nav">
<ul class="nav nav-list">
<li>
<a href="#quickfeatures"> Quick features</a>
<ul class="nav nav-list">
<li>
<a href="#installation"> Installation</a>
</li>
</ul>
</li>
<li>
<a href="#usage"> Quick Use</a>
<ul class="nav nav-list">
<li>
<a href="#alert"> $.alert</a>
</li>
<li>
<a href="#confirm"> $.confirm</a>
</li>
<li>
<a href="#dialog"> $.dialog</a>
</li>
<li>
<a href="#shorthand"> Shorthand usage</a>
</li>
</ul>
</li>
<li>
<a href="#customizing">Customizing</a>
<ul class="nav nav-list">
<li>
<a href="#buttontext"> Button text</a>
</li>
<li>
<a href="#buttonstyle"> Button style</a>
</li>
<li>
<a href="#hide-elements"> Hide elements</a>
</li>
<li>
<a href="#custom-width"> Custom width</a>
</li>
<li>
<a href="#icons"> Icons</a>
</li>
<li>
<a href="#close-icon"> Close icon</a>
</li>
</ul>
</li>
<li>
<a href="#animations"> Animations</a>
<ul class="nav nav-list">
<li>
<a href="#animations"> Animations</a>
</li>
<li>
<a href="#animationbounce"> Bounce Effect</a>
</li>
<li>
<a href="#animationspeed"> Animation Speed</a>
</li>
</ul>
</li>
<li>
<a href="#themes"> Themes</a>
</li>
<li>
<a href="#ajaxloading"> Ajax loading</a>
<ul class="nav nav-list">
<li>
<a href="#urlprefix">Using URL: prefix</a>
</li>
<li>
<a href="#ajaxpromise">Using ajax promise</a>
</li>
</ul>
</li>
<li>
<a href="#autoclose"> Auto close</a>
</li>
<li>
<a href="#backgrounddismiss"> Background dismiss</a>
</li>
<li>
<a href="#keyboardactions"> Keyboard actions</a>
<ul class="nav nav-list">
<li>
<a href="#keyboardactions"> Keyboard actions</a>
</li>
<li>
<a href="#keyboardactions-config">Using custom keys</a>
</li>
</ul>
</li>
<li>
<a href="#rtl"> RTL Support</a>
</li>
<li>
<a href="#callbacks"> Callbacks</a>
</li>
<li>
<a href="#globaldefaults"> Global defaults</a>
</li>
<li>
<a href="#options"> Options</a>
</li>
<li>
<a href="#api"> Api</a>
<ul class="nav nav-list">
<li>
<a href="#api-close"> .close()</a>
</li>
<li>
<a href="#api-isclosed"> .isClosed()</a>
</li>
<li>
<a href="#api-settitle"> .setTitle()</a>
</li>
<li>
<a href="#api-setcontent"> .setContent()</a>
</li>
<li>
<a href="#api-seticon"> .setIcon()</a>
</li>
<li>
<a href="#api-setdialogcenter"> .setDialogCenter()</a>
</li>
<li>
<a href="#api-body"> .$body</a>
</li>
<li>
<a href="#api-content"> .$content</a>
</li>
<li>
<a href="#api-title"> .$title</a>
</li>
<li>
<a href="#api-icon"> .$icon</a>
</li>
<li>
<a href="#api-confirmbutton"> .$confirmButton</a>
</li>
<li>
<a href="#api-cancelbutton"> .$cancelButton</a>
</li>
<li>
<a href="#api-closebutton"> .$closeButton</a>
</li>
<li>
<a href="#api-target"> .$target</a>
</li>
</ul>
</li>
<li>
<a href="#methods"> Methods</a>
</li>
</ul>
</div>
</div>
<div class="col-md-9 col-sm-12">
<!-- introduction -->
<section>
<header>
<h3>Welcome to jquery-confirm!</h3>
<p>
Easy to use and highly flexible! <br/>
A jQuery plugin that provides great set of features like,
Auto-close, Ajax-loading, Themes, Animations and more. <br>
This plugin is actively developed, I would love you have your suggestions.
</p>
<a href="https://github.com/craftpip/jquery-confirm/issues" target="empty" class="btn btn-success"><i class="fa fa-bug fa-fw"></i> Please post your Suggestions here.</a>
</header>
</section>
<hr>
<section id="quickfeatures">
<h1>Quick features</h1>
<p>These features can practically be used like so.</p>
<div class="row">
<div class="col-md-3">
<button class="btn btn-primary btn-block example-p-1">Alerts</button>
<p class="text-success">Elegant Alerts.</p>
</div>
<div class="col-md-3">
<button class="btn btn-primary btn-block example-p-2">Confirmation</button>
<p class="text-success">Stacked Confirmations</p>
</div>
<div class="col-md-3">
<button class="btn btn-primary btn-block example-p-7-1">Act like Prompt</button>
<p class="text-success">Need input?</p>
</div>
<div class="col-md-3">
<button class="btn btn-primary btn-block example-p-3">Background dismiss</button>
<p class="text-success">Not so important modal</p>
</div>
</div>
<div class="row">
<div class="col-md-3">
<button class="btn btn-primary btn-block example-p-4">Using as dialogs/modals</button>
<p class="text-success">Its also a Dialog.</p>
</div>
<div class="col-md-3">
<button class="btn btn-primary btn-block example-p-5">Asynchronous content</button>
<p class="text-success">Loading from remote places</p>
</div>
<div class="col-md-3">
<button class="btn btn-primary btn-block example-p-6">Auto-close</button>
<p class="text-success">Some actions maybe critical</p>
</div>
<div class="col-md-3">
<button class="btn btn-primary btn-block example-p-7">Keystrokes</button>
<p class="text-success">Keyboard actions?</p>
</div>
</div>
<div class="row">
<div class="col-md-3">
<button class="btn btn-primary btn-block example-pc-1">Alignment</button>
<p class="text-success">Automatically centered</p>
</div>
<div class="col-md-3">
<button class="btn btn-primary btn-block example-pc-2">Images</button>
<p class="text-success">Loading images</p>
</div>
<div class="col-md-3">
<button class="btn btn-primary btn-block example-pc-3">Animations</button>
<p class="text-success">Clean animations</p>
</div>
</div>
<script type="text/javascript">
$(' .example-pc-3').on('click', function () {
$.alert({
title: 'Animations',
content: 'jquery-confirm provides 12 animations to choose from.',
animation: 'rotate',
closeAnimation: 'right',
opacity: 0.5
});
});
$('.example-pc-1').on('click', function () {
$.confirm({
title: 'This is smoooth',
content: '<p>You can add content and not worry about the alignment. The goal is to make a Interactive dialog!.</p>' +
'<button type="button">Click me to add content</button> <span> <br></span> ',
confirmButtonClass: 'btn-primary',
animation: 'zoom',
onOpen: function(){
var that = this;
this.$content.find('button').click(function(){
that.$content.find('span').append('<br>This is awesome!!!!');
});
},
confirmButton: 'Say "Wowww"',
confirm: function () {
this.$content.find('span').append('<br>Wowww');
return false; // prevent dialog from closing.
}
});
});
$('.example-pc-2').on('click', function () {
window.b = $.confirm({
title: 'Adding images',
content: 'Images from flickr <br><img src="https://c2.staticflickr.com/4/3891/14354989289_2eec0ba724_b.jpg">',
confirmButtonClass: 'btn-primary',
animation: 'zoom',
animationClose: 'top',
confirmButton: 'Add more',
confirm: function () {
this.$content.append('<img src="https://c2.staticflickr.com/6/5248/5240523362_8d6d315391_b.jpg">');
return false; // prevent dialog from closing.
}
});
});
$('.example-p-1').on('click', function () {
$.alert({
title: 'Hey!',
content: 'This is a simple alert to the user. <br> with some <strong>HTML</strong> <em>contents</em>',
confirmButton: 'Okay',
confirmButtonClass: 'btn-primary',
icon: 'fa fa-info',
animation: 'zoom',
confirm: function () {
$.alert('Okay action clicked.');
}
});
});
$('.example-p-2').on('click', function () {
$.confirm({
title: 'A secure action',
content: 'Its smooth to do multiple confirms at a time. <br> Click proceed for another modal',
confirmButton: 'Proceed',
confirmButtonClass: 'btn-info',
icon: 'fa fa-question-circle',
animation: 'scale',
animationClose: 'top',
opacity: 0.5,
confirm: function () {
$.confirm({
title: 'This maybe critical',
content: 'Critical actions can have multiple confirmations like this one.',
confirmButton: 'Yes, sure!',
icon: 'fa fa-warning',
confirmButtonClass: 'btn-warning',
animation: 'zoom',
confirm: function () {
$.alert('A very critical action triggered!');
}
});
}
});
});
$('.example-p-3').on('click', function () {
$.alert({
title: 'Background dismiss',
content: 'By default the user is not allowed to click outside the modal. Click outside the modal to close.',
confirmButton: 'okay',
confirmButtonClass: 'btn-info',
animation: 'bottom',
icon: 'fa fa-check',
backgroundDismiss: true
});
});
$('.example-p-4').on('click', function () {
$.confirm({
title: 'Title here',
content: 'Need a popup modal?, no problem!<br>disable the buttons, and get a full functional modal. <br><h3>HTML inside modals</h3><h4><strong>centered on the screen</strong></h4><h5><em>Like a boss</em></h5>' +
'<button type="button">Interactive too</button>',
confirmButton: false,
cancelButton: false,
animation: 'scale',
onOpen: function(){
var that = this;
this.$content.find('button').click(function(){
that.$content.html('As simple as that !');
})
}
});
});
$('.example-p-5').on('click', function () {
$.confirm({
title: 'Asynchronous content',
content: 'url:table.html',
animation: 'top',
columnClass: 'col-md-6 col-md-offset-3',
closeAnimation: 'bottom',
backgroundDismiss: true,
});
});
$('.example-p-6').on('click', function () {
$.confirm({
title: 'Auto close',
content: 'Some actions maybe critical, prevent it with the Auto close feature. This dialog will automatically trigger cancel after the timer runs out.',
autoClose: 'cancel|10000',
confirmButtonClass: 'btn-danger',
confirmButton: 'Delete Ben\'s account',
cancelButton: 'Close',
confirm: function () {
$.alert('You deleted Ben\'s account!');
},
cancel: function () {
$.alert('Ben just got saved!');
}
});
});
$('.example-p-7').on('click', function () {
$.confirm({
title: 'Keystrokes Enabled!',
keyboardEnabled: true,
content: 'Press ENTER to confirm, ESC to cancel.<br> Use <code>keyboardEnabled:true</code> to turn it on.',
backgroundDismiss: true,
confirm: function () {
$.alert('confirm triggered!');
},
cancel: function () {
$.alert('cancel triggered!');
}
});
});
$('.example-p-7-1').on('click', function () {
$.confirm({
title: 'A simple form',
content: 'url:form.txt',
confirm: function () {
var input = this.$b.find('input#input-name');
var errorText = this.$b.find('.text-danger');
if (input.val() == '') {
errorText.show();
return false;
} else {
$.alert('Hello ' + input.val());
}
}
});
});
</script>
</section>
<!-- Installation -->
<section id="installation">
<h2>Installation</h2>
<p><strong>Download </strong> <br>
Download the Latest version and use files in the <code>/dist/</code> folder.
</p>
<p><strong>via Bower: </strong> <br>
<code>
$ bower install craftpip/jquery-confirm
</code>
</p>
<p><strong>via Npm: </strong> <br>
<code>
$ npm install jquery-confirm
</code>
</p>
</section>
<!-- basic usage -->
<section id="usage">
<h2>Quick Usage</h2>
<p><strong>Dependencies:</strong></p>
<ul>
<li>Bootstrap by Twitter >= v2</li>
<li>jQuery library > v1.8</li>
</ul>
<div class="row">
<div class="col-md-12">
<h4 id="alert">Alert</h4>
<p>
<i class="fa fa-info-circle"></i> <code>$.alert()</code> Has only confirm button.
</p>
<button class="example1 btn btn-primary">example alert</button>
<script type="text/javascript">
$('.example1').on('click', function () {
$.alert({
title: 'Alert!',
content: 'Simple alert!',
confirm: function () {
$.alert('Confirmed!');
}
});
});
</script>
<div class="space10"></div>
<pre class="prettyprint linenums"><code class="js">$.alert({
title: 'Alert!',
content: 'Simple alert!',
confirm: function(){
$.alert('Confirmed!'); // shorthand.
}
});
</code></pre>
</div>
<div class="col-md-12">
<h4 id="confirm">
Confirm
</h4>
<p>
<i class="fa fa-info-circle"></i> <code>$.confirm()</code> Has both confirm & cancel buttons.
</p>
</div>
<div class="col-md-6">
<button class="example2 btn btn-primary">example confirm</button>
<script type="text/javascript">
$('.example2').on('click', function () {
$.confirm({
title: 'Confirm!',
content: 'Simple confirm!',
confirm: function () {
$.alert('Confirmed!');
},
cancel: function () {
$.alert('Canceled!');
}
});
});
</script>
<div class="space10"></div>
<pre class="prettyprint linenums"><code class="js">$.confirm({
title: 'Confirm!',
content: 'Simple confirm!',
confirm: function(){
$.alert('Confirmed!');
},
cancel: function(){
$.alert('Canceled!')
}
});
</code></pre>
</div>
<div class="col-md-6">
<p>
<a class="example2-1-1 btn btn-primary" data-title="Goto twitter?" href="http://twitter.com/craftpip">Goto twitter</a>
</p>
<script>
$('.example2-1-1').confirm({
content: "This will take you to my twitter <br> You can access the clicked element by <code>this.$target</code>",
});
</script>
<span>HTML</span>
<pre class="prettyprint linenums"><code class="html"><a class="twitter" data-title="Goto twitter?" href="http://twitter.com/craftpip">Goto twitter</a>
</code></pre>
<span>Javascript</span>
<pre class="prettyprint linenums"><code class="js">$('a.twitter').confirm(options);
</code></pre>
<p>The alias $.confirm was made to emulate the native confirm(). <br/>
<i class="fa fa-info"></i> By default on "confirm" the window will be redirected to the href provided, but if the `options` has the confirm callback, it will be called instead. Use <a href="#api-target">this.$target</a> to get the clicked element.</p>
</div>
<div class="col-md-12">
<h4 id="dialog">
Dialog
</h4>
<p >
<i class="fa fa-info-circle"></i> <code>$.dialog()</code> Hides both confirm & cancel buttons. (Shows close [x] button)
</p>
<button class="example2-1 btn btn-primary">example dialog</button>
<script type="text/javascript">
$('.example2-1').on('click', function () {
$.dialog({
title: 'Text content!',
content: 'Simple modal!'
});
});
</script>
<div class="space10"></div>
<pre class="prettyprint linenums"><code class="js">$.dialog({
title: 'Text content!',
content: 'Simple modal!',
});
</code></pre>
</div>
<div class="col-md-12">
<h4 id="shorthand">Shorthand usage</h4>
<p>
The shorthand thingy takes in two string arguments, first one is the content of the dialog and second the title of the dialog.
The second argument is optional.
</p>
<pre class="prettyprint linenums"><code class="js">$.alert('Content here', 'Title here');
$.confirm('A message', 'Title is optional');
$.dialog('Just to let you know');
</code></pre>
</div>
</div>
</section>
<section id="customizing">
<h2>Customizing</h2>
<div class="alert alert-info">
<p>
<i class="fa fa-bookmark fa-fw"></i> <strong>NOTE</strong>:
The <code>$.confirm()</code>, <code>$.dialog()</code> & <code>$.alert()</code> methods are alias of <code>jconfirm()</code>.<br>
<i class="fa fa-fw"></i> All three methods indirectly call the jconfirm base function altering the provided options.
</p>
</div>
<div class="alert alert-warning">
<p>
<i class="fa fa-info fa-fw"></i> <strong>ADVANCED: </strong> <code>this.$body</code> is the body div for jquery-confirm. You can find and alter any element at run time.
</p>
</div>
<h4 id="buttontext">Button text</h4>
<div class="section">
<p>Change the button text for confirm and cancel.</p>
<button class="btn btn-primary example3">click me!</button>
<script type="text/javascript">
$('.example3').on('click', function () {
$.confirm({
confirmButton: 'Yes i agree',
cancelButton: 'NO never !'
})
});
</script>
<div class="space10"></div>
<pre class="prettyprint linenums"><code class="html">$.confirm({
confirmButton: 'Yes i agree',
cancelButton: 'NO never !'
});
</code></pre>
</div>
<h4 id="buttonstyle">Button style</h4>
<div class="section">
<p>Apply the classes you want in the buttons.</p>
<p class="text-info">
Available bootstrap options are <code>btn-primary</code> <code>btn-inverse</code> <code>btn-warning</code> <code>btn-info</code> <code>btn-danger</code> <code>btn-success</code>
</p>
<button class="btn btn-primary example3-1">info and danger!</button>
<button class="btn btn-primary example3-2">warning and success!</button>
<script type="text/javascript">
$('.example3-1').on('click', function () {
$.confirm({
confirmButtonClass: 'btn-info',
cancelButtonClass: 'btn-danger'
});
;
});
$('.example3-2').on('click', function () {
$.confirm({
confirmButtonClass: 'btn-warning',
cancelButtonClass: 'btn-success'
});
});
</script>
<div class="space10"></div>
<pre class="prettyprint linenums"><code class="html">$.confirm({
confirmButtonClass: 'btn-info',
cancelButtonClass: 'btn-danger'
})
</code></pre>
</div>
<h4 id="hide-elements">Hide elements</h4>
<div class="section">
<p>Hide the Title/Content/Confirm Button/Cancel Button/Close icon when u don't need them.</p>
<button class="btn btn-primary example-hide-1">No title</button>
<button class="btn btn-primary example-hide-5">No content</button>
<button class="btn btn-primary example-hide-2">No title/cancel Button</button>
<button class="btn btn-primary example-hide-3">No title/cancel/confirm Button</button>
<button class="btn btn-primary example-hide-4">No title/cancel/confirm Button + no close icon</button>
<script type="text/javascript">
$('.example-hide-1').on('click', function () {
$.confirm({
title: false,
content: 'Hide the title.'
});
});
$('.example-hide-2').on('click', function () {
$.confirm({
title: false,
content: 'Hide the cancel button & title.',
cancelButton: false
});
});
$('.example-hide-3').on('click', function () {
$.confirm({
title: false,
content: 'Hide both the buttons & title.',
cancelButton: false,
confirmButton: false
});
});
$('.example-hide-4').on('click', function () {
$.confirm({
title: false,
content: 'If you hide everything, what can do you to close the modal?. <br>"backgroundDismiss" is active on this one, click outside to close.',
cancelButton: false,
confirmButton: false,
backgroundDismiss: true,
closeIcon: false
});
});
$('.example-hide-5').on('click', function () {
$.confirm({
content: false
});
});
</script>
<div class="space10"></div>
<pre class="prettyprint linenums"><code class="html">$.confirm({
title: false, // hides the title.
cancelButton: false // hides the cancel button.
confirmButton: false, // hides the confirm button.
closeIcon: false, // hides the close icon.
content: false, // hides content block.
});
</code></pre>
<i class="fa fa-info-circle fa-fw"></i> <strong>NOTE:</strong>
<br>
<p>
By default the closeIcon is visible if both confirm & cancel buttons are hidden. (dialog mode).<br>
To explicitly show or hide closeIcon set <code>closeIcon: true</code> or <code>closeIcon: false</code>.<br>
Shorthand to hide both buttons is to use <code>$.dialog()</code>.
</p>
</div>
<h4 id="custom-width">Custom width</h4>
<div class="section">
<p>
Jquery-confirm uses bootstrap's grid system for its layout. <br>
You can simply provide column classes to adjust the modal's width.
</p>
<p class="text-info"> <i class="fa fa-magic fa-fw"></i> You can also set responsive layouts. <a href="http://getbootstrap.com/examples/grid/" target="_empty">Bootstrap grid docs</a> </p>
<button class="btn btn-primary grid-1">col-md-6 col-md-offset-3</button>
<button class="btn btn-primary grid-2">col-md-4 col-md-offset-4 (default)</button>
<button class="btn btn-primary grid-3">col-md-4 </button>
<button class="btn btn-primary grid-4">col-md-4 col-md-offset-8</button>
<button class="btn btn-primary grid-5">col-md-12</button>
<div class="space10"></div>
<script type="text/javascript">
$('.grid-1').on('click', function () {
$.confirm({
columnClass: 'col-md-6 col-md-offset-3'
}); // empty because its default.
});
$('.grid-2').on('click', function () {
$.confirm({
columnClass: 'col-md-4 col-md-offset-4'
});
});
$('.grid-3').on('click', function () {
$.confirm({
columnClass: 'col-md-4'
});
});
$('.grid-4').on('click', function () {
$.confirm({
columnClass: 'col-md-4 col-md-offset-8'
});
});
$('.grid-5').on('click', function () {
$.confirm({
columnClass: 'col-md-12'
});
});
</script>
<pre class="prettyprint linenums"><code>$.confirm({
columnClass: 'col-md-4 col-md-offset-4'
});
$.confirm({
columnClass: 'col-md-4'
});
$.confirm({
columnClass: 'col-md-4 col-md-offset-8 col-xs-4 col-xs-offset-8'
});</code></pre>
</div>
<h4 id="icons">Icons</h4>
<div class="section">
<p>Give meaning to your dialog with custom icons.<br>
Read about Font Awesome <a href="http://fortawesome.github.io/Font-Awesome">here</a>.
</p>
<button class="btn btn-primary example21-1">Using bootstrap's glyphicon</button>
<button class="btn btn-primary example21-2">Using font-awesome</button>
<button class="btn btn-primary example21-3">Animated font-awesome</button>
<script type="text/javascript">
$('.example21-1').on('click', function () {
$.confirm({
icon: 'glyphicon glyphicon-heart',
title: 'glyphicon'
});
});
$('.example21-2').on('click', function () {
$.confirm({
icon: 'fa fa-warning',
title: 'font-awesome'
});
});
$('.example21-3').on('click', function () {
$.alert({
icon: 'fa fa-spinner fa-spin',
title: 'Working!',
content: 'Sit back, we are processing your request. <br>The animated icon is provided by Font-Awesome!'
});
});
</script>
<div class="space10"></div>
<pre class="prettyprint linenums"><code>$.confirm({
icon: 'glyphicon glyphicon-heart',
title: 'glyphicon'
});
$.confirm({
icon: 'fa fa-warning',
title: 'font-awesome'
});
$.alert({
icon: 'fa fa-spinner fa-spin',
title: 'Working!',
content: 'Sit back, we are processing your request. <br>The animated icon is provided by Font-Awesome!'
});
</code></pre>
</div>
<h4 id="close-icon">Close icon</h4>
<div class="section">
<p>
jQuery confirm uses <code>&times;</code> html entity for this close symbol, however you can use Any icon of your choice (fa, glyphicon, zmdi)
</p>
<div class="alert alert-info">
Using $.dialog will show the close Icon by default.
</div>
<button class="example15-1-3-4 btn btn-primary">With closeIcon</button>
<div class="space10"></div>
<pre class="prettyprint linenums"><code>$.alert({
closeIcon: true
});
</code></pre>
<p>
Using your own class for icons.
</p>
<button class="example15-1-3-5 btn btn-primary">Using glyphicon</button>
<button class="example15-1-3-6 btn btn-primary">Using font awesome</button>
<script>
$('.example15-1-3-4').click(function(){
$.alert({
closeIcon: true,
});
});
$('.example15-1-3-5').click(function(){
$.alert({
closeIcon: true,
closeIconClass: 'glyphicon glyphicon-remove',
});
});
$('.example15-1-3-6').click(function(){
$.alert({
closeIcon: true,
closeIconClass: 'fa fa-close'
})
});
</script>
<div class="space10"></div>
<pre class="prettyprint linenums"><code>$.alert({
closeIcon: true,
closeIconClass: 'fa fa-close' // or 'glyphicon glyphicon-remove'
});
</code></pre>
</div>
</section>
<section id="animations">
<h2>Animations</h2>
<p>
Impression lies in what we see.<br>
Different animations can be set for open and close events.
</p>
<!--<h3 id="animation">ANIMATION!</h3>-->
<div class="section">
<p>2D animations:</p>
<button class="example16 btn btn-primary">right</button>
<script type="text/javascript">
$('.example16').on('click', function () {
$.confirm({
animation: 'right',
closeAnimation: 'left',
});
});
</script>
<button class="example17 btn btn-primary">left</button>
<script type="text/javascript">
$('.example17').on('click', function () {
$.confirm({
animation: 'left',
closeAnimation: 'right',
});
});
</script>
<button class="example18 btn btn-primary">bottom</button>
<script type="text/javascript">
$('.example18').on('click', function () {
$.confirm({
animation: 'bottom',
closeAnimation: 'top'