I have made a slideshow by addClass
and removeClass
, but there are no effects for slider. So I want to add some effects on the method addClass
and removeClass
.
$('#button-next').on('click', function () {
$('#big img').css({
'display': 'none'
});
var currentActiveImage = $('.image-shown');
var nextActiveImage = currentActiveImage.next();
if (nextActiveImage.length == 0) {
nextActiveImage = $('.carousel-inner img').first();
}
currentActiveImage.removeClass('image-shown').addClass('image-hidden').css({
'z-index': '-10'
});
nextActiveImage.addClass('image-shown').removeClass('image-hidden').css({
'z-index': '2000'
});
$('.carousel-inner img').not([currentActiveImage, nextActiveImage]).css('z-index', 1);
e.preventDefault()
});
$('#button-prev').on('click', function () {
var currentActiveImage = $('.image-shown');
var nextActiveImage = currentActiveImage.prev();
if (nextActiveImage.length == 0) {
nextActiveImage = $('.carousel-inner img').last();
}
currentActiveImage.removeClass('image-shown').addClass('image-hidden').css({
'z-index': '-10'
});
nextActiveImage.addClass('image-shown').removeClass('image-hidden').css({
'z-index': '2000'
});
$('.carousel-inner img').not([currentActiveImage, nextActiveImage]).css('z-index', 1);
e.preventDefault()
});
addClass
andremoveClass
of jQueryUI? Did you import it?