@@ -464,12 +464,6 @@ <h1>Quick features</h1>
464
464
animationClose : 'top' ,
465
465
opacity : 0.5 ,
466
466
buttons : {
467
- hey : {
468
- keys : [
469
- 'shift' ,
470
- 'enter'
471
- ] ,
472
- } ,
473
467
'confirm' : function ( ) {
474
468
$ . confirm ( {
475
469
title : 'This maybe critical' ,
@@ -482,18 +476,21 @@ <h1>Quick features</h1>
482
476
'Confirm' : function ( ) {
483
477
$ . alert ( 'A very critical action triggered!' ) ;
484
478
} ,
485
- hey : {
486
- text : 'wow' ,
487
- action : function ( ) {
488
- $ . alert ( 'yp' ) ;
489
- }
479
+ cancel : function ( ) {
480
+ $ . alert ( 'cancel clicked' ) ;
490
481
}
491
482
}
492
483
} ) ;
493
484
} ,
494
- 'yetAnother' : {
495
- text : 'Buttons'
496
- }
485
+ cancel : function ( ) {
486
+ $ . alert ( 'cancel clicked' ) ;
487
+ } ,
488
+ moreButtons : {
489
+ text : 'something else' ,
490
+ action : function ( ) {
491
+ $ . alert ( 'something else clicked' ) ;
492
+ }
493
+ } ,
497
494
}
498
495
} ) ;
499
496
} ) ;
@@ -618,7 +615,7 @@ <h1>Quick features</h1>
618
615
// alignment
619
616
$ ( '.example-pc-1' ) . on ( 'click' , function ( ) {
620
617
$ . confirm ( {
621
- title : 'This is smoooth ' ,
618
+ title : 'This is smooth ' ,
622
619
content : '<p>You can add content and not worry about the alignment. The goal is to make a Interactive dialog!.</p>' +
623
620
'<button type="button">Click me to add content</button> <span> <br></span> ' ,
624
621
confirmButtonClass : 'btn-primary' ,
@@ -672,7 +669,7 @@ <h1>Quick features</h1>
672
669
$ ( ' .example-pc-3' ) . on ( 'click' , function ( ) {
673
670
$ . alert ( {
674
671
title : 'Animations' ,
675
- content : 'jquery-confirm provides 12 animations to choose from.' ,
672
+ content : 'jquery-confirm provides 12 open & close animations to choose from.' ,
676
673
animation : 'rotate' ,
677
674
closeAnimation : 'right' ,
678
675
theme : 'white, black' ,
@@ -724,45 +721,38 @@ <h2>Quick Usage</h2>
724
721
725
722
< p > < strong > Dependencies:</ strong > </ p >
726
723
< ul >
727
- < li > Bootstrap by Twitter > = v2 </ li >
724
+ < li > Bootstrap by Twitter > = v3 </ li >
728
725
< li > jQuery library > v1.8</ li >
729
726
</ ul >
730
727
< div class ="row ">
731
728
< div class ="col-md-12 ">
732
729
< h4 id ="alert "> Alert</ h4 >
733
730
734
731
< p >
735
- < i class ="fa fa-info-circle "> </ i > < code > $.alert()</ code > Has only confirm button.
732
+ < i class ="fa fa-info-circle "> </ i > < code > $.alert()</ code > adds a button if no buttons are specified, this lets the user to close the modal .
736
733
</ p >
737
734
< button class ="example1 btn btn-primary "> example alert</ button >
738
735
< script type ="text/javascript ">
739
736
$ ( '.example1' ) . on ( 'click' , function ( ) {
740
737
$ . alert ( {
741
738
title : 'Alert!' ,
742
739
content : 'Simple alert!' ,
743
- confirm : function ( ) {
744
- $ . alert ( 'Confirmed!' ) ;
745
- }
746
740
} ) ;
747
741
} ) ;
748
742
</ script >
749
743
< div class ="space10 "> </ div >
750
744
< pre class ="prettyprint linenums "> < code class ="js "> $.alert({
751
- title: 'Alert!',
752
- content: 'Simple alert!',
753
- confirm: function(){
754
- $.alert('Confirmed!'); // shorthand.
755
- }
756
- });
757
- </ code > </ pre >
745
+ title: 'Alert!',
746
+ content: 'Simple alert!',
747
+ });</ code > </ pre >
758
748
</ div >
759
749
< div class ="col-md-12 ">
760
750
< h4 id ="confirm ">
761
751
Confirm
762
752
</ h4 >
763
753
764
754
< p >
765
- < i class ="fa fa-info-circle "> </ i > < code > $.confirm()</ code > Has both confirm & cancel buttons.
755
+ < i class ="fa fa-info-circle "> </ i > < code > $.confirm()</ code > takes options as is, no buttons will be shown if none is specified .
766
756
</ p >
767
757
</ div >
768
758
< div class ="col-md-6 ">
@@ -772,26 +762,36 @@ <h4 id="confirm">
772
762
$ . confirm ( {
773
763
title : 'Confirm!' ,
774
764
content : 'Simple confirm!' ,
775
- confirm : function ( ) {
776
- $ . alert ( 'Confirmed!' ) ;
777
- } ,
778
- cancel : function ( ) {
779
- $ . alert ( 'Canceled!' ) ;
765
+ buttons : {
766
+ confirm : function ( ) {
767
+ $ . alert ( 'Confirmed!' ) ;
768
+ } ,
769
+ cancel : function ( ) {
770
+ $ . alert ( 'Canceled!' ) ;
771
+ } ,
772
+ somethingElse : function ( ) {
773
+ $ . alert ( 'Something else?' ) ;
774
+ }
780
775
}
781
776
} ) ;
782
777
} ) ;
783
778
</ script >
784
779
< div class ="space10 "> </ div >
785
780
< pre class ="prettyprint linenums "> < code class ="js "> $.confirm({
786
- title: 'Confirm!',
787
- content: 'Simple confirm!',
788
- confirm: function(){
789
- $.alert('Confirmed!');
790
- },
791
- cancel: function(){
792
- $.alert('Canceled!')
793
- }
794
- });
781
+ title: 'Confirm!',
782
+ content: 'Simple confirm!',
783
+ buttons: {
784
+ confirm: function () {
785
+ $.alert('Confirmed!');
786
+ },
787
+ cancel: function () {
788
+ $.alert('Canceled!');
789
+ },
790
+ somethingElse: function(){
791
+ $.alert('Something else?');
792
+ }
793
+ }
794
+ });
795
795
</ code > </ pre >
796
796
</ div >
797
797
< div class ="col-md-6 ">
@@ -806,12 +806,10 @@ <h4 id="confirm">
806
806
} ) ;
807
807
</ script >
808
808
< span > HTML</ span >
809
- < pre class ="prettyprint linenums "> < code class ="html "> <a class="twitter" data-title="Goto twitter?" href="http://twitter.com/craftpip">Goto twitter</a>
810
- </ code > </ pre >
809
+ < pre class ="prettyprint linenums "> < code class ="html "> <a class="twitter" data-title="Goto twitter?" href="http://twitter.com/craftpip">Goto twitter</a></ code > </ pre >
811
810
< span > Javascript</ span >
812
- < pre class ="prettyprint linenums "> < code class ="js "> $('a.twitter').confirm(options);
813
- </ code > </ pre >
814
- < p > The alias $.confirm was made to emulate the native confirm(). < br />
811
+ < pre class ="prettyprint linenums "> < code class ="js "> $('a.twitter').confirm(options);</ code > </ pre >
812
+ < p > The alias $.fn.confirm was made to emulate the native confirm(). < br />
815
813
< 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 >
816
814
</ div >
817
815
< div class ="col-md-12 ">
@@ -820,23 +818,27 @@ <h4 id="dialog">
820
818
</ h4 >
821
819
822
820
< p >
823
- < i class ="fa fa-info-circle "> </ i > < code > $.dialog()</ code > Hides both confirm & cancel buttons. (Shows close [x] button )
821
+ < i class ="fa fa-info-circle "> </ i > < code > $.dialog()</ code > removes buttons and explicitly shows the closeIcon (× )
824
822
</ p >
825
823
< button class ="example2-1 btn btn-primary "> example dialog</ button >
826
824
< script type ="text/javascript ">
827
825
$ ( '.example2-1' ) . on ( 'click' , function ( ) {
828
826
$ . dialog ( {
829
827
title : 'Text content!' ,
830
- content : 'Simple modal!'
828
+ content : 'Simple modal!' ,
829
+ buttons : {
830
+ aRandomButton : function ( ) {
831
+ // this will be removed.
832
+ }
833
+ }
831
834
} ) ;
832
835
} ) ;
833
836
</ script >
834
837
< div class ="space10 "> </ div >
835
838
< pre class ="prettyprint linenums "> < code class ="js "> $.dialog({
836
- title: 'Text content!',
837
- content: 'Simple modal!',
838
- });
839
- </ code > </ pre >
839
+ title: 'Text content!',
840
+ content: 'Simple modal!',
841
+ });</ code > </ pre >
840
842
</ div >
841
843
< div class ="col-md-12 ">
842
844
< h4 id ="shorthand "> Shorthand usage</ h4 >
@@ -845,10 +847,9 @@ <h4 id="shorthand">Shorthand usage</h4>
845
847
The shorthand thingy takes in two string arguments, first one is the content of the dialog and second the title of the dialog.
846
848
The second argument is optional.
847
849
</ p >
848
- < pre class ="prettyprint linenums "> < code class ="js "> $.alert('Content here', 'Title here');
849
- $.confirm('A message', 'Title is optional');
850
- $.dialog('Just to let you know');
851
- </ code > </ pre >
850
+ < pre class ="prettyprint linenums "> < code class ="js "> $.alert('Content here', 'Title here'); < a href ="# " class ="example-sh-1 "> click me</ a >
851
+ $.confirm('A message', 'Title is optional'); < a href ="# " class ="example-sh-2 "> click me</ a >
852
+ $.dialog('Just to let you know'); < a href ="# " class ="example-sh-3 "> click me</ a > </ code > </ pre >
852
853
</ div >
853
854
854
855
</ div >
0 commit comments