Answer the question
In order to leave comments, you need to log in
Does the slider scroll through one slide?
There is a slider, it does not work correctly, flips through the slide
I can’t understand what’s wrong
here is the code
<div class="carousel-container2">
<div class="carousel"><a class="control-next" href="#">Prev</a> <a class="control-prev" href="#">Next</a>
<ul style="width: 2094px; margin-left: -698px;">
<li><img alt="" src="/bg/zvn/1.jpg" /></li>
<li><img alt="" src="/bg/zvn/2.jpg" /></li>
<li><img alt="" src="/bg/zvn/3.jpg" /></li>
</ul>
</div>
<a class="btn zakaz" href="#">Заказать консультацию</a>
</div>
$(function() {
var slideCount = $('.carousel ul li').length;
var slideWidth = $('.carousel ul li').width();
var slideHeight = $('.carousel ul li').height();
var sliderUlWidth = slideCount * slideWidth;
$('.carousel ul').css({ width: sliderUlWidth, marginLeft: - slideWidth });
$('.carousel ul li:last-child').prependTo('.carousel ul');
function moveLeft() {
$('.carousel ul').animate({
left: + slideWidth
}, 500, function () {
$('.carousel ul li:last-child').prependTo('.carousel ul');
$('.carousel ul').css('left', '');
});
};
function moveRight() {
$('.carousel ul').animate({
left: - slideWidth
}, 500, function () {
$('.carousel ul li:first-child').appendTo('.carousel ul');
$('.carousel ul').css('left', '');
});
};
$('.carousel a.control-prev').click(function () {
moveLeft();
return false;
});
$('.carousel a.control-next').click(function () {
moveRight();
return false;
});
$('.tab-menu .item').mouseover(function(e) {
$('.tab-menu .item').removeClass('active');
$(this).addClass('active');
var index = $('.tab-menu .item').index(this);
$('.tab-content .poly').removeClass('active').eq(index).addClass('active');
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question