Zambo107 Posted August 24, 2020 Share Posted August 24, 2020 Site URL: https://www.diabeticexchangeusa.com/price-list On the mobile view I would like for the category selector to be a drop down menu rather than what it is as default. Link to comment
tuanphan Posted August 24, 2020 Share Posted August 24, 2020 Add to Home > Settings > Advanced > Code Injection > Header <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script> <script> $(document).ready(function(){ if (jQuery(window).width() <= 767) { $(document).ready(function() { var catItem = $('a.category-filter-link'); var itemTag = $(catItem).html(); var catDrop = "<select name='Categories' id='categories' class='catDrop'>"; if (itemTag !== undefined) { catItem.each(function(i) { var fixLoc = $(this).html().trim().replace(/\s+/g, '+').replace(/&/g, '%26').replace('amp;', ''); catDrop = catDrop + '<option value=' + fixLoc + '>' + $(this).html() + '</option>'; i++; }); catDrop = catDrop + "</select>"; $(catDrop).insertAfter($('.category-filter-wrapper')); } var urlCat = window.location.href.split("?category=")[1]; if (urlCat !== undefined) { var fixCat = urlCat.replace(/\%27/g, "'") $(".catDrop").val(fixCat); } $(".catDrop").change(function() { if ($(this).val() == "All") { window.location = "/"; } else { window.location = "?category=" + $(this).val(); } }); }); } }); </script> <style> @media screen and (max-width:767px) { nav.category-filter-wrapper { display: none; } } </style> then save & refresh your site. Code by @rwp Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
sharine Posted January 8, 2021 Share Posted January 8, 2021 (edited) On 8/24/2020 at 5:00 PM, tuanphan said: Add to Home > Settings > Advanced > Code Injection > Header <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script> <script> $(document).ready(function(){ if (jQuery(window).width() <= 767) { $(document).ready(function() { var catItem = $('a.category-filter-link'); var itemTag = $(catItem).html(); var catDrop = "<select name='Categories' id='categories' class='catDrop'>"; if (itemTag !== undefined) { catItem.each(function(i) { var fixLoc = $(this).html().trim().replace(/\s+/g, '+').replace(/&/g, '%26').replace('amp;', ''); catDrop = catDrop + '<option value=' + fixLoc + '>' + $(this).html() + '</option>'; i++; }); catDrop = catDrop + "</select>"; $(catDrop).insertAfter($('.category-filter-wrapper')); } var urlCat = window.location.href.split("?category=")[1]; if (urlCat !== undefined) { var fixCat = urlCat.replace(/\%27/g, "'") $(".catDrop").val(fixCat); } $(".catDrop").change(function() { if ($(this).val() == "All") { window.location = "/"; } else { window.location = "?category=" + $(this).val(); } }); }); } }); </script> <style> @media screen and (max-width:767px) { nav.category-filter-wrapper { display: none; } } </style> then save & refresh your site. Code by @rwp Hey, Can I get help with this? Should I send an email? Edited January 8, 2021 by sharine Link to comment
tuanphan Posted January 10, 2021 Share Posted January 10, 2021 On 1/8/2021 at 11:30 PM, sharine said: Hey, Can I get help with this? Should I send an email? You can send an email if you want. Above code doesn't work? Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
sharine Posted January 11, 2021 Share Posted January 11, 2021 On 1/10/2021 at 4:17 AM, tuanphan said: You can send an email if you want. Above code doesn't work? No, it doesn't unfortunately. Link to comment
tuanphan Posted January 11, 2021 Share Posted January 11, 2021 2 hours ago, sharine said: No, it doesn't unfortunately. try contacting @rwp Can you share your site url? Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment