Nomisneerg Posted January 20, 2021 Posted January 20, 2021 Site URL: https://www.cboothandson.co.uk/ Hello I'm hoping someone can help me with this issue. I want to insert some CSS that will stack the different 'category navigation' links at the top of a product page on top of one another when viewing a product page on mobile devices. At the moment customers have to scroll along the 'category navigation bar' to find the category they are looking for. There is no indicator for the customer either, so unless they know this is how this site works they will miss a number of the categories. I have attached a screenshot below of how I would like them to appear on mobile devices - or something similar. Thank you in advance.
Solution paul2009 Posted January 20, 2021 Solution Posted January 20, 2021 (edited) Try something like this in Design > Custom CSS: @media only screen and (max-width: 640px) { .products.collection-content-wrapper .nested-category-children { flex-wrap: wrap; overflow-x: hidden; justify-content: center; } .products.collection-content-wrapper .nested-category-title { text-align: center; } } Did this help? Please give feedback by clicking an icon below ⬇️ Edited January 4, 2023 by paul2009 Begona, edoublema, amanda03 and 1 other 3 1 Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.
Nomisneerg Posted January 20, 2021 Author Posted January 20, 2021 24 minutes ago, paul2009 said: Try something like this in Design > Custom CSS: @media only screen and (max-width: 640px) { .products.collection-content-wrapper .nested-category-children { flex-wrap: wrap; overflow-x: hidden; justify-content: center; } .products.collection-content-wrapper .nested-category-title { text-align: center; } } Hi @paul2009 Thank you for this, it worked perfect! Top man 😄 tuanphan 1
HAM Posted March 22, 2021 Posted March 22, 2021 On 1/20/2021 at 3:10 PM, paul2009 said: Try something like this in Design > Custom CSS: @media only screen and (max-width: 640px) { .products.collection-content-wrapper .nested-category-children { flex-wrap: wrap; overflow-x: hidden; justify-content: center; } .products.collection-content-wrapper .nested-category-title { text-align: center; } } Hi @paul2009 this worked really great however when I click on one of the categories via mobile then they all disappear again in the sub category. Is there any way to change this so category titles are visible at all times? website is https://hamtheillustrator.com danaddub 1
tuanphan Posted March 22, 2021 Posted March 22, 2021 @HAM Try adding this to Design > Custom CSS (Dont remove Paul code) @media screen and (max-width:767px) { .nested-category-tree-wrapper { display: flex !important; float: none !important; min-width: unset !important; max-width: 100% !important; } } 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!)
HAM Posted March 22, 2021 Posted March 22, 2021 2 minutes ago, tuanphan said: @HAM Try adding this to Design > Custom CSS (Dont remove Paul code) @media screen and (max-width:767px) { .nested-category-tree-wrapper { display: flex !important; float: none !important; min-width: unset !important; max-width: 100% !important; } } Hey thanks @tuanphan this sorta worked - only issue is I now have two duplicated category menu's stacked on top of each other. Anyway to keep it so we only have Paul's menu's visible on every page?
tuanphan Posted March 31, 2021 Posted March 31, 2021 @HAM Do you still neeed help on this? 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!)
JohnPo Posted April 14, 2021 Posted April 14, 2021 On 1/20/2021 at 3:10 PM, paul2009 said: Try something like this in Design > Custom CSS: @media only screen and (max-width: 640px) { .products.collection-content-wrapper .nested-category-children { flex-wrap: wrap; overflow-x: hidden; justify-content: center; } .products.collection-content-wrapper .nested-category-title { text-align: center; } } This solution worked great for me! So happy I tracked this solution down! I also added this line of code to reduce the space before the categories: padding-top: 10px; So it reads: //mobile categories list @media only screen and (max-width: 640px) { .products.collection-content-wrapper .nested-category-children { flex-wrap: wrap; overflow-x: hidden; justify-content: left; padding-top: 10px; } .products.collection-content-wrapper .nested-category-title { text-align: left; } //mobile categories list end You can change 'left' to 'center' to center the text on the mobile view too.
erkprk Posted April 16, 2021 Posted April 16, 2021 @tuanphan @paul2009 same issue as HAM here. I want the category nav to appear on all the category pages but when I add @tuanphan's code, it duplicates the nav and it also appears as a sidebar style instead of all the category names in one line. (I'm talking about the mobile version specifically). Any way we can keep paul's code just as it is but on every category page? url: https://www.eniwill.com/esp
tuanphan Posted April 19, 2021 Posted April 19, 2021 On 4/16/2021 at 10:13 PM, erkprk said: @tuanphan @paul2009 same issue as HAM here. I want the category nav to appear on all the category pages but when I add @tuanphan's code, it duplicates the nav and it also appears as a sidebar style instead of all the category names in one line. (I'm talking about the mobile version specifically). Any way we can keep paul's code just as it is but on every category page? url: https://www.eniwill.com/esp I see no category here 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!)
erkprk Posted April 21, 2021 Posted April 21, 2021 On 4/19/2021 at 4:09 AM, tuanphan said: I see no category here The link should be /esp (not esp/salud). The categories disappear when you click on one of the categories.
tuanphan Posted April 21, 2021 Posted April 21, 2021 34 minutes ago, erkprk said: The link should be /esp (not esp/salud). The categories disappear when you click on one of the categories. esp/salud when you clicking on salud link in left sidebar category 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!)
anna_ Posted December 17, 2022 Posted December 17, 2022 (edited) On 4/21/2021 at 12:33 PM, tuanphan said: esp/salud when you clicking on salud link in left sidebar category @tuanphan Would you be able to show me the code for the stacking of categories on mobile but for a video page at all please? www.igroomhub.com.au/microbites Edited December 17, 2022 by anna_
tuanphan Posted December 21, 2022 Posted December 21, 2022 On 12/18/2022 at 5:58 AM, anna_ said: @tuanphan Would you be able to show me the code for the stacking of categories on mobile but for a video page at all please? www.igroomhub.com.au/microbites See this 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!)
Begona Posted January 6, 2023 Posted January 6, 2023 site: mistoa.mx Hi @paul2009and @tuanphan I'm having some issues with categories on mobile. This is the way my categories display: And this is the way I want them to display: The code provided by @paul2009 is not working (probably because of some other code), so I would appreciate any help. Thanks!
paul2009 Posted January 8, 2023 Posted January 8, 2023 (edited) On 1/6/2023 at 10:17 PM, Begona said: The code provided by @paul2009 is not working (probably because of some other code), so I would appreciate any help. I can see that you have two errors elsewhere in your code injections. Some sections of code include additional brackets that are not required and are therefore causing errors. These errors prevent the other code from running. Take a look at the two sections of code that start with: if($(window).width() >= 768) { If you correct (or remove) these sections of code, other code should function 🙂 Did this help? Please give feedback by clicking an icon below ⬇️ Edited January 8, 2023 by paul2009 Begona 1 Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.
Begona Posted January 8, 2023 Posted January 8, 2023 Thank you so much for taking a look, @paul2009 I removed the code you suggested, but the categories are still stacked. Do you have another idea of what might be interfering? Thank you!! paul2009 1
paul2009 Posted January 8, 2023 Posted January 8, 2023 1 hour ago, Begona said: I removed the code you suggested, but the categories are still stacked. Do you have another idea of what might be interfering? There is other CSS (above the new CSS) that is targeting the same elements (for example .nested-category-tree-wrapper) and forcing them to stack. Because you have used "!important" in these settings, they override all other settings, which is why the new CSS doesn't make any difference 🙂 As an aside, and for the benefit of anyone else reading this, adding !important is rarely a good idea. I see a number of posts in the forum that treat the !important tag like it is a secret weapon that solves all your custom CSS problems, but it really isn't! If custom CSS isn't working as expected, it's much better to find out why than to add !important. I hope this is helpful to someone in a similar situation. Did this help? Please give feedback by clicking an icon below ⬇️ Begona 1 Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment