File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 400400 throw new Error ( "formatterName must be a function or a falsy value" ) ;
401401 }
402402
403+ function evaluate ( val ) {
404+ return $ . isFunction ( val ) ? val ( ) : val ;
405+ }
406+
403407 /**
404408 * blurs any Select2 container that has focus when an element outside them was clicked or received focus
405409 *
429433 } ) ;
430434 } ) ;
431435
432- function evaluate ( val ) {
433- return $ . isFunction ( val ) ? val ( ) : val ;
434- }
436+ /**
437+ * Closes any opened Select2s when the window is resized
438+ */
439+ $ ( window ) . resize ( debounce ( 100 , function ( ) {
440+ $ ( ".select2-container.select2-dropdown-open" ) . select2 ( 'close' ) ;
441+ } ) ) ;
442+
443+ /**
444+ * Closes any opened Select2s when the window is scrolled
445+ */
446+ $ ( window ) . scroll ( debounce ( 100 , function ( ) {
447+ $ ( ".select2-container.select2-dropdown-open" ) . select2 ( 'close' ) ;
448+ } ) ) ;
449+
435450
436451 /**
437452 * Creates a new class
You can’t perform that action at this time.
0 commit comments