File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 176176 }
177177 } ;
178178
179- $ ( window ) . on ( 'resize' , that . fixPositionCapture ) ;
179+ $ ( window ) . on ( 'resize.autocomplete ' , that . fixPositionCapture ) ;
180180
181181 that . el . on ( 'keydown.autocomplete' , function ( e ) { that . onKeyPress ( e ) ; } ) ;
182182 that . el . on ( 'keyup.autocomplete' , function ( e ) { that . onKeyUp ( e ) ; } ) ;
242242
243243 fixPosition : function ( ) {
244244 var that = this ,
245- offset ;
245+ offset ,
246+ styles ;
246247
247248 // Don't adjsut position if custom container has been specified:
248249 if ( that . options . appendTo !== 'body' ) {
251252
252253 offset = that . el . offset ( ) ;
253254
254- $ ( that . suggestionsContainer ) . css ( {
255+ styles = {
255256 top : ( offset . top + that . el . outerHeight ( ) ) + 'px' ,
256257 left : offset . left + 'px'
257- } ) ;
258+ } ;
259+
260+ if ( that . options . width === 'auto' ) {
261+ styles . width = ( that . el . outerWidth ( ) - 2 ) + 'px' ;
262+ }
263+
264+ $ ( that . suggestionsContainer ) . css ( styles ) ;
258265 } ,
259266
260267 enableKillerFn : function ( ) {
715722 var that = this ;
716723 that . el . off ( '.autocomplete' ) . removeData ( 'autocomplete' ) ;
717724 that . disableKillerFn ( ) ;
718- $ ( window ) . off ( 'resize' , that . fixPositionCapture ) ;
725+ $ ( window ) . off ( 'resize.autocomplete ' , that . fixPositionCapture ) ;
719726 $ ( that . suggestionsContainer ) . remove ( ) ;
720727 }
721728 } ;
You can’t perform that action at this time.
0 commit comments