This repository was archived by the owner on Feb 14, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 108
108
109
109
this . _attachEvents ( ) ;
110
110
111
+ this . clickedOutside = function ( e ) {
112
+ // Clicked outside the datetimepicker, hide it
113
+ if ( $ ( e . target ) . closest ( '.datetimepicker' ) . length === 0 ) {
114
+ that . hide ( ) ;
115
+ }
116
+ }
117
+
111
118
this . formatViewType = 'datetime' ;
112
119
if ( 'formatViewType' in options ) {
113
120
this . formatViewType = options . formatViewType ;
211
218
var selector = this . bootcssVer === 3 ? '.prev span, .next span' : '.prev i, .next i' ;
212
219
this . picker . find ( selector ) . toggleClass ( this . icons . leftArrow + ' ' + this . icons . rightArrow ) ;
213
220
}
214
- $ ( document ) . on ( 'mousedown' , function ( e ) {
215
- // Clicked outside the datetimepicker, hide it
216
- if ( $ ( e . target ) . closest ( '.datetimepicker' ) . length === 0 ) {
217
- that . hide ( ) ;
218
- }
219
- } ) ;
221
+
222
+ $ ( document ) . on ( 'mousedown' , this . clickedOutside ) ;
220
223
221
224
this . autoclose = false ;
222
225
if ( 'autoclose' in options ) {
362
365
363
366
remove : function ( ) {
364
367
this . _detachEvents ( ) ;
368
+ $ ( document ) . off ( 'mousedown' , this . clickedOutside ) ;
365
369
this . picker . remove ( ) ;
366
370
delete this . picker ;
367
371
delete this . element . data ( ) . datetimepicker ;
You can’t perform that action at this time.
0 commit comments