Support » Plugin: FooBox Image Lightbox WordPress Plugin » Repaint/reload the gallery on button click

  • Resolved rignano

    (@rignano)


    I’ve created a masonry gallery with captions under the thumbnails. I’ve also created a checkbox which shows or hides the captions when the checkbox is checked/unchecked. It does this by adding or removing the “fg-captions-bottom” class from the gallery div (using Javascript).

    This works fine but would be better if it would also refresh/repaint the gallery in order to update the spacing between the thumbnails. The spacing gets updated if I change the viewport size but I am trying to get this to happen when I click a button instead.

    Thanks.

    (Sorry, meant to put this in the FooGallery forum)

    • This topic was modified 2 months, 1 week ago by rignano.
Viewing 1 replies (of 1 total)
  • I got the answer from the developer and thought I would post in case anyone else needed it:

    jQuery(".toggle-caption-button").on("click", function(e){
    	// your code that toggles the captions
    	
    	// the code that tells the gallery to lay itself out again
    	jQuery("#foogallery-gallery-XXX").foogallery("layout");
    });

    Obviously just need to swap in the relevant button and gallery details.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.