How to Stack an Index Page Gallery in Pacific Mobile View

How to Stack a Grid Gallery in Squarespace Mobile View

Want to stack your grid gallery on Pacific? You’re in the right place if you’re using a Gallery Collection in an index page (like the Pacific demo homepage). If not, you’ll want to check out my post on Stacking a Grid Gallery in Squarespace Mobile View.

The Pacific template for Squarespace includes an image gallery on the homepage, added as a Gallery Collection to the index page:

 
Pacific template index page with Gallery
 
squarespace pacific template homepage slideshow
 

The default view is a slideshow, but you can change this in Site Styles to display as a grid with max columns of two, three, four, or five. While these grid galleries in Pacific can look amazing in desktop view, they look very cramped on mobile.

 
pacific-gallery-site-styles.png
Pacific template homepage Grid Gallery on mobile view
 
 

Change the Gallery Grid to Stack in Pacific Mobile View (for Index Page Collections)

To change the default Gallery Grid setting so the images stack on mobile, just add the following code to Custom CSS.

Custom CSS Menu in Squarespace

Note: this code works if you are setting your Grid Max Columns to TWO in Site Styles. If your Grid Max columns is THREE, just change the section “grid-max-columns-two” to “grid-max-columns-three.” Same for settings of FOUR and FIVE.

/* stack index gallery grid images on mobile */
@media only screen and (max-width: 640px)
{.collection-type-index.design-grid.grid-max-columns-two .index-gallery .slide-wrapper {
    -webkit-flex: 0 0 100% !important;
    -ms-flex: 0 0 100% !important;
    flex: 0 0 100% !important;
}
}

If you also want the stacking behavior when you use your phone in landscape mode, or on larger mobile devices, simply increase the max-width above.

Save your code. Then refresh your page and you’ll see the images are now stacked. Much better!

 
Stacked gallery grid on Paciifc homepage in Squarespace
 

Changing the Grid Gallery to Stack on just One Page

If you want to change the Grid Gallery mobile behavior for only one page, that works a bit differently. Instead of using the Custom CSS block, you’ll add <style> tags to the code and paste it into the Page Header Code Injection.

In the Pages panel, hover over a page (or index) title, then click the settings icon that appears on the right.

Page settings in Squarespace

From Page Settings, navigate to the Advanced tab and paste the code below into Page Header Code Injection then click save.

Squarespace page header code injection
<!-- stack gallery grid on mobile -->
<style>
 /* stack index gallery grid images on mobile */
@media only screen and (max-width: 640px)
{.collection-type-index.design-grid.grid-max-columns-two .index-gallery .slide-wrapper {
    -webkit-flex: 0 0 100% !important;
    -ms-flex: 0 0 100% !important;
    flex: 0 0 100% !important;
}
}
</style>

Note: This code works for Pacific family templates (Pacific, Bryler, Charlotte, Fulton, Horizon, and Naomi). I haven’t tested on other templates so YMMV.


A big thank you to Big Flavour Marketing who hired me to solve this problem and allowed me to post it here for others. Good karma headed your way, Big Flavour!

If this post was helpful, I’d love to know. Drop a note in the Comments ↓ with a link to your site and how you used the CSS.