Photograffix Posted June 8 Share Posted June 8 Hi 👋 I have added a button to toggle the display of the captions for the masonry gallery using the following code.  <script> $(function(){ $('#block-yui_3_17_2_1_1686230394275_3985 a').on('click', function(event){ event.preventDefault(); $('.gallery-caption').toggle(); if ($('#block-yui_3_17_2_1_1686230394275_3985 a').text() == 'Hide Captions') { $('#block-yui_3_17_2_1_1686230394275_3985 a').text('Show Captions') } else { $('#block-yui_3_17_2_1_1686230394275_3985 a').text('Hide Captions') } }) $('.gallery-caption').hide(); $('#block-yui_3_17_2_1_1686230394275_3985 a').text('Show Captions'); }) </script> The toggle works, but I need to re-initialize the masonry grid to allow the captions to occupy space between the items. Does anyone know the code that will achieve this? It must be used in the Squarespace code already, as the masonry grid will re-initialise if you change the browser's width. 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