Jump to content

Recommended Posts

Hello,

I have an online shop with a range of categories. On the mobile view, I have an issue that the categories are listed horizontally and customers are making it clear that it's not obvious that you can scroll to the right to view additional categories. The image I attached shows a scroll bar but that doesn't show on an actual phone (screenshot from desktop editor).

Does anyone know of alternative setups for the categories on mobile? Dropdown would probably work.

Mobile Shop view.png

Link to comment
On 8/30/2023 at 6:10 PM, Chicagogolfconnection said:

See below for the shop url. My guess is that a dropdown would be the most effective. What do you think after looking at the page?

 

https://www.chicagogolfconnection.com/store-2-1

To Website > Website Tools > Code Injection > Footer > Then check again on real mobile

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>  
<script>
$(document).ready(function() {
  var catItem = $('.category-item .category-link:not(.child)');
  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, '').replace('amp;', '').replace('--', '-').toLowerCase();
      catDrop = catDrop + '<option value=' + fixLoc + '>' + $(this).html() + '</option>';
      i++;
    });
    catDrop = catDrop + "</select>";
    $(catDrop).insertAfter($('.page-section:first-of-type'));
  }
  var urlCat = window.location.href.split("/shop/")[1];
  if (urlCat !== undefined) {
    var fixCat = urlCat.replace(/\%27/g, "'")
    $(".catDrop").val(fixCat);
  }
  $(".catDrop").change(function() {
    if ($(this).val() == "all") {
      window.location = "/shop/";
    } else {
      window.location = "/shop/" + $(this).val();
    }
  });
});
</script>
<style>
@media screen and (max-width:767px) {
nav.category-filter-wrapper {
    display: none;
}
}
</style>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.