Title: Javascript event to trigger gallery layout render
Last modified: August 31, 2016

---

# Javascript event to trigger gallery layout render

 *  Resolved [Giancarlo Mosso](https://wordpress.org/support/users/gmosso/)
 * (@gmosso)
 * [10 years ago](https://wordpress.org/support/topic/javascript-event-to-trigger-gallery-layout-render/)
 * Hi,
    in some of the sites I developed I use your plugin (version 1.3.5.9) under
   tabs. This is an example: [http://www.lefatedizucchero.com/torte/torte-decorate-pasta-di-zucchero-compleanno-torino/](http://www.lefatedizucchero.com/torte/torte-decorate-pasta-di-zucchero-compleanno-torino/)
   When the user clicks a tab, the Javascript event handler (you can find it embedded
   in the page) triggers the event “smartresize” to force gallery layout rendering:`
   $(window).trigger("smartresize");` Without triggering this event the gallery 
   is not displayed correctly. This works well with plugin versions 1.3.x. But it
   does not work anymore with the new 1.5.x series. What event do I have to trigger
   to have the same functionality in 1.5.x version ? I would like to continue using
   your plugin because I find it very good. Thanks in advance. Best Regards
 * [https://wordpress.org/plugins/envira-gallery-lite/](https://wordpress.org/plugins/envira-gallery-lite/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Thomas Griffin](https://wordpress.org/support/users/griffinjt/)
 * (@griffinjt)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/javascript-event-to-trigger-gallery-layout-render/#post-7423003)
 * What about trying just `$(window).trigger('resize');`?
 *  Thread Starter [Giancarlo Mosso](https://wordpress.org/support/users/gmosso/)
 * (@gmosso)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/javascript-event-to-trigger-gallery-layout-render/#post-7423039)
 * Hello Thomas,
    thank you for your reply. I had already tried triggering the resize
   event, I tried again to confirm and unfortunately it does not work. The resize
   event is fired (e.g. if a attach an event handler that logs a string I can see
   the string logged in the console). But it does not force layout rendering. Instead
   if I resize manually the window the layout is rendered correctly. That is why
   in the 1.3.x version I had used the “smartresize” event, but in this version 
   it does not work anymore. If I don’t find a solution I’ll have to stay on version
   1.3.x or use a different plugin. Giancarlo
 *  [Thomas Griffin](https://wordpress.org/support/users/griffinjt/)
 * (@griffinjt)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/javascript-event-to-trigger-gallery-layout-render/#post-7423041)
 * I researched it a little bit more. It looks like with isotope v3 (which is the
   library we use for resizing), they removed the smartresize function/event. Let
   me see if I can dig in and find a different way to make this happen.
 *  Thread Starter [Giancarlo Mosso](https://wordpress.org/support/users/gmosso/)
 * (@gmosso)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/javascript-event-to-trigger-gallery-layout-render/#post-7423054)
 * Hi Thomas,
    by digging into the code of your plugin I found the solution. I’ll
   share here in the hope it could be useful to someone else. The call to be done
   is: `envira_isotopes[<galleryNumber>].enviratope('layout');` envira_isotopes 
   is an array defined by your plugin, so this solution will work as long as you
   don’t rename that variable, in case I’ll fix my code. In any case thank you for
   your support and willing to solve my problem. Giancarlo

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Javascript event to trigger gallery layout render’ is closed to new replies.

 * ![](https://ps.w.org/envira-gallery-lite/assets/icon-256x256.png?rev=2022837)
 * [Envira Gallery - Image Photo Gallery, Albums, Video Gallery, Slideshows & More](https://wordpress.org/plugins/envira-gallery-lite/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/envira-gallery-lite/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/envira-gallery-lite/)
 * [Active Topics](https://wordpress.org/support/plugin/envira-gallery-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/envira-gallery-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/envira-gallery-lite/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Giancarlo Mosso](https://wordpress.org/support/users/gmosso/)
 * Last activity: [9 years, 12 months ago](https://wordpress.org/support/topic/javascript-event-to-trigger-gallery-layout-render/#post-7423054)
 * Status: resolved