alfredomoraphoto Posted January 3 Posted January 3 Hello, I recently transitioned from 7.0 to 71. On my old site I had a different home page with vertical images and another homepage with horizontal images. This code below was used to automatically switch the home page depending if the visitor was on mobile or desktop. Is there an equivalent set of CSS code or functionality in 7.1? /* show home page block dependent on screen size * / @media only screen and (max-width: 780px) { #home { display: none; } } @media only screen and (min-width: 781px) { #home-mobile/mobile { display: none; } } Thanks!
MySquare24 Posted January 3 Posted January 3 (edited) Hi alfredomoraphoto You need to find the page-id and apply the CSS on it for keep it different, If you share the website URL I provide you the page-id of you're home page 👨✈️Professional Squarespace Developer - Custom Code Contact: Submit Request Edited January 3 by MySquare24
alfredomoraphoto Posted January 3 Author Posted January 3 Thank you. My site is https://alfredomora.net I tried to create a portfolio page with just vertical images but I'm not sure if that is equivalent to the gallery page in 7.0.
tuanphan Posted January 4 Posted January 4 If you can add 2 sections, we can give code to show 1 on desktop, show another on mobile. I also have a plugin (free) to achieve 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!)
alfredomoraphoto Posted January 4 Author Posted January 4 Thank you Tuan! Ok let me try adding another section to the homepage with only vertical images.
alfredomoraphoto Posted January 4 Author Posted January 4 Tuan, ok the new section has been added. Thank you.
alfredomoraphoto Posted January 5 Author Posted January 5 I'm going to delete that new section since my site is live. Let me know when you want me to add it back. I tried the plugin but it won't let me add the code to the image block.
Solution tuanphan Posted January 8 Solution Posted January 8 On 1/6/2024 at 12:00 AM, alfredomoraphoto said: I'm going to delete that new section since my site is live. Let me know when you want me to add it back. I tried the plugin but it won't let me add the code to the image block. Suppose you have 2 sections on homepage, top and second To hide top on desktop, add this code to Website Tools (Under Not Linked) > Custom CSS @media screen and (min-width:768px) { body.homepage article section:first-child { display: none !important; } } To hide second on mobile, use this code @media screen and (max-width:767px) { body.homepage article section:nth-child(2) { display: none !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!)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment