Last Updated: 15 Oct 2015 14:13 by ADMIN
Marin Bratanov
Created on: 05 May 2014 11:31
Category: Rotator
Type: Bug Report
FIX In a Carousel type rotator when the last or second item is to be shown and the animation should go through the first item, one more item is rotated
You can observe it here: by clicking either of the sequences. Note: set the rotator to CarouselButtons to avoid cinfusion stemming from automatic advance.
- red, grey, green. You will see red instead of green
- blue, green, gray. You will see blue instead of gray
One more item was rotated in each case.

A workaround is to disable animations for these second and last items when their counterpart is currently shown:
function OnClientItemClicked(sender, args) {
	var shouldAnimate = true;
	var indextToChangeTo = args.get_item().get_index();
	var currIndex = sender.get_currentItemIndex();
	var itemsCount = sender.get_items().length;
	if (currIndex == itemsCount - 1 && indextToChangeTo == 1 || //last item is shown, the second item is clicked
		currIndex == 1 && indextToChangeTo == itemsCount - 1) { //second item is shown, last item is clicked
		shouldAnimate = false;
	sender.set_currentItemIndex(indextToChangeTo, shouldAnimate);