Reputation: 355
I am using this http://www.gmarwaha.com/jquery/jcarousellite/ for vertical slider.
Now the settings i have is:
var sliderShowItems = $(.vSlider).attr('id').split('-', 2);
$('.vSlider').jCarouselLite({
visible: sliderShowItems[1],
scroll: sliderShowItems[1],
auto: 6000,
speed: 650,
vertical: true,
pauseOnHover: false
});
Now the problem is that I want to get amount of visible items from CMS dynamically (hence the var sliderShowItems), but jCaroulseLite breaks if I do it like that. It only shows the the first 4 (if I have put 4 in my cms) and then just starts to scroll randomly. If I just put for example visible: 4 and scroll: 4 it works fine. But when I put the number dynamically like this it breaks up :( And Im not sure why? Any advice?
Upvotes: 1
Views: 571
Reputation: 10407
It depends on what value you're getting from sliderShowItems, are you trying to show more images if there are more images? because you can try something like.
var sliderShowItems = $(.vSlider).length;
sliderShowItems = Math.ceil(sliderShowItems / 3);
$('.vSlider').jCarouselLite({
visible: sliderShowItems,
scroll: sliderShowItems,
auto: 6000,
speed: 650,
vertical: true,
pauseOnHover: false
});
Upvotes: 2