ryrych / rcarousel

yet another jQuery UI carousel
http://ryrych.github.com/rcarousel/
171 stars 48 forks source link

Responsive design #53

Open howardk opened 12 years ago

howardk commented 12 years ago

Since rcarousel is dependent on a declared width and height, it doesn't work on responsive design-based websites. Is there a way to dynamically change those values to make it responsive? Or can the width and height be done through percentages?

raghuureddy commented 11 years ago

I want to do the same. Is it possible?

alitabriz commented 11 years ago

me too, help plz

Aft3rm4th commented 8 years ago

rcarousel isn't responsive? Please make it responsive by making it dynamic (for dimensions such as width and height, make them possible using percentages)

yfdo commented 3 years ago

You can create a variable with JavaScript which gets the user screen width and pass it to the width property in rcarousel.

var carousel_width = document.documentElement.clientWidth;

$("#carousel").rcarousel({ width: carousel_width, })

You can also do calculations on carousel_width such as multiplying it by a percentage. Just remember to use something like Math.floor() so that the variable you pass to rcarousel is a positive integer.