-
Notifications
You must be signed in to change notification settings - Fork 165
Touch devices: show styled trigger but use browser's default UI to select an option #66
Comments
+1 Maybe an option for selecting the default ui or the defined styles by the plugin? |
+1 For this too. |
+1 Looking forward to this feature |
+1 This would be a great addition |
This is actually supposed to be be the behavior on mobile (styled button, system dropdown). Looks like it might be a regression; I'll have to check it out. |
I've been thinking about a workaround and just tried it in a project: The trick is to fancify All selects have the class Here's the JavaScript:
|
We managed to make a work around for this by making a customization on fancySelect.js. Currently, we are using version 1.0.0, and we navigate to the block where the event "click.fs" on the li element (the user's choice) is caught: options.on('click.fs', 'li', function(e) {
...
return sel.val(clicked.data('raw-value')).trigger('change.fs').trigger('blur.fs').trigger('focus.fs');
} Seems like the event 'focus.fs' on the select element is responsible for the trigger of the native ios select menu popup, so we replaced this line with the following: if (!isiOS) {
return sel.val(clicked.data('raw-value')).trigger('change.fs').trigger('blur.fs').trigger('focus.fs');
}
return sel.val(clicked.data('raw-value')).trigger('change.fs').trigger('blur.fs'); Horray!!! It works! We advise the fancySelect dev guys to include this on the next release, as we observed that in the version 1.1.0 the issue still remains. |
I want to display my "fancified" selects but keep the default UI of the browser for users browsing my website on touch devices (smartphones, tablets etc.). I'm not really asking how to detect touch devices (I know it's possible through userAgent tests or with the help of Modernizr) but more about how can I fancify my selects without triggering the custom options list.
Thank you very much for your time and help with this!
The text was updated successfully, but these errors were encountered: