Forums › Forums › Search & Filter Pro › Change radio buttons to drop down on mobile devices
- This topic has 7 replies, 2 voices, and was last updated 8 years, 3 months ago by
Anonymous.
Viewing 8 posts - 1 through 8 (of 8 total)
-
Anonymous(Private) March 18, 2017 at 8:58 pm #97723
Hi,
Can someone point me in the right direction on how I can achieve to display Drop Down list instead of Radio buttons for the filter on mobile devices?
I got this far:
// Create the dropdown base for the Filter jQuery("<select id="md-dropdown-filter"></select>").appendTo(".sf-field-category"); // Create default option "Filter Simulations..." jQuery("<option ></option>", { "selected": "selected", "value" : "", "text" : "Filter Simulations..." }).appendTo(".sf-field-category select"); // Populate dropdown with filter items jQuery(".sf-field-category li").each(function() { var el = jQuery(this); jQuery("<option ></option>", { "value" : el.attr("href"), "text" : el.text() }).appendTo(".sf-field-category select"); });
But I don’t know how to generate the value for the filter.
Kind regards,
GabrielAnonymous(Private) March 18, 2017 at 9:35 pm #97731Update of the code above:
Closer but not yet there 🙂
// Create the dropdown base for the Filter jQuery("<select ></select>").appendTo(".sf-field-category"); // Create default option "Filter Simulations..." jQuery("<option ></option>", { "selected": "selected", "value" : "", "text" : "Filter Simulations..." }).appendTo(".sf-field-category select"); // Populate dropdown with filter items jQuery(".sf-field-category li").each(function() { var el = jQuery(this); jQuery("<option ></option>", { "value" : el.attr("href"), "text" : el.text() }).appendTo(".sf-field-category select"); }); //basicaly I need to change here the value to lowercase and add ?_sft_category= before it in the URL jQuery(".sf-field-category select").change(function() { window.location = jQuery(this).find("option:selected").val(); });
-
AuthorPosts
Viewing 8 posts - 1 through 8 (of 8 total)