Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit fda3e5e

Browse files
Selectmenu: the preventFocusZoom option check needs to be insde the event binding.
1 parent b694e07 commit fda3e5e

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

js/jquery.mobile.forms.select.js

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -174,25 +174,34 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
174174
});
175175

176176
// In many situations, iOS will zoom into the select upon tap, this prevents that from happening
177-
if ( self.options.preventFocusZoom ) {
178-
self.button.bind( "vmousedown", function() {
179-
$.mobile.zoom.disable( true );
180-
});
181-
self.label.bind( "click focus", function() {
182-
$.mobile.zoom.disable( true );
183-
});
184-
self.select.bind( "focus", function() {
185-
$.mobile.zoom.disable( true );
186-
});
187-
self.button.bind( "mouseup", function() {
177+
self.button.bind( "vmousedown", function() {
178+
if ( self.options.preventFocusZoom ) {
179+
$.mobile.zoom.disable( true );
180+
}
181+
});
182+
self.label.bind( "click focus", function() {
183+
if ( self.options.preventFocusZoom ) {
184+
$.mobile.zoom.disable( true );
185+
}
186+
});
187+
self.select.bind( "focus", function() {
188+
if ( self.options.preventFocusZoom ) {
189+
$.mobile.zoom.disable( true );
190+
}
191+
});
192+
self.button.bind( "mouseup", function() {
193+
if ( self.options.preventFocusZoom ) {
188194
setTimeout(function() {
189195
$.mobile.zoom.enable( true );
190196
}, 0 );
191-
});
192-
self.select.bind( "blur", function() {
197+
}
198+
});
199+
self.select.bind( "blur", function() {
200+
if ( self.options.preventFocusZoom ) {
193201
$.mobile.zoom.enable( true );
194-
});
195-
}
202+
}
203+
});
204+
196205
},
197206

198207
selected: function() {

0 commit comments

Comments
 (0)