Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trigger a height calc - jQuery Cycle2

I've got a page using Cycle2 to run a slideshow with a hide show element to it.

It's all working great, except when I expand the slide and close it again, the height goes off. If I slightly resize the window, this will trigger the recalculation and then the space from the height gets put back right.

I'm using

data-cycle-auto-height="container"

I basically just need to trigger this action that happens on a resize.

Any tips?

like image 202
Steve de Niese Avatar asked Nov 12 '22 20:11

Steve de Niese


1 Answers

The cheat way to do it would be to assign a listener to your plugin's open/close events that triggers a window resize.

$(window).on('your_event_name', function() {
  $(this).resize();
});

If you've got the time though, you should dig in a little deeper and figure out what's actually happening. Ideally, your plugin would handle this stuff on it's own.

like image 167
Thomas Patrick Horton Avatar answered Nov 15 '22 01:11

Thomas Patrick Horton