specious / cloud9carousel

:cyclone: 3D-perspective carousel for jQuery / Zepto
http://j.mp/cloud9demo
233 stars 88 forks source link

Re-Initalize when resize window #42

Open LaYOOOs opened 2 years ago

LaYOOOs commented 2 years ago

I would like to ask, how can i re-init the script, when the window size (width) modified.

Best Regards, LaYOOOs

specious commented 2 years ago

Most likely you're interested in taking into account the new dimensions of the parent container when it is resized.

Currently the carousel dimensions are decided based on the dimensions of the parent container during initialization, if they weren't explicitly specified:

https://github.com/specious/cloud9carousel/blob/c25c4ccf21c0f831142b313d0e733b79a6731bb2/jquery.cloud9carousel.js#L133-L136

It would make sense to change the code to calculate these carousel dimensions on every render, so that the carousel would become responsive to layout changes.

Pull requests are welcome.