specious / cloud9carousel

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

how to destroy slider? #5

Closed jacko closed 8 years ago

jacko commented 8 years ago

Hi! How can i destroy slider and then initialize it again ?

For example on window resize my images change their sizes and i want to reinitialize slider with new image sizes ...

specious commented 8 years ago

I think you can achieve that by changing the carousel's attributes on the fly. You can obtain a reference to the carousel object using $("#carousel").data('carousel'). For example,

var carousel = $("#carousel").data('carousel');
carousel.farScale = 0.4;
carousel.render();

This changes the scaling of the items as they become more distant, and immediately re-renders the carousel to show the new appearance.

Here's a live demo: http://jsbin.com/hiwopisowe/1/edit?output

jacko commented 8 years ago

tnx :+1: