CSS-Tricks/MovingBoxes

Re-initialize with updating the sizes

Opened this issue · 3 comments

Hello.

Is there any way to re-initialize the slider and update the slides sizes?

Well, it's not really documented, but you can set stored width (or update the width option, which is deprecated) before updating

var slider = $('#slider');
// set a new movingboxes width
slider.data('movingBoxes').width = 300;
// update MovingBoxes
slider.movingBoxes();

Thank you for reply, Mottie,but that is not what I meant, sorry.

I mean when there is a slider in the display:none div, for example and when the div is revealed its height is expectedly 0.

Is there a way around this with a MovingBoxes script?
Thanks.
// I know that I can hide the div with position: absolute; visibility: hidden;, initialize the slider and then hide it completely.

Ok, when the slider is display:none (or in a parent with such style), it does not tell any data, and also is not accepting methods from outside.

May be handy:
I just wrap the slider in a overflow: hidden; height: 0; container when I need to hide it yet need it accessible.