Your IP : 3.135.196.97
$(document).ready(function() {
// compare
$('.compare__cell').hover(function() {
var currentIndex = $(this).index();
$(this).parents('.compare').find('.c-line').each(function(index, el) {
$(this).find('.compare__cell').eq( currentIndex).addClass('hover');
});
}, function() {
$(this).parents('.compare').find('.c-line').each(function(index, el) {
$(this).find('.compare__cell').removeClass('hover');
});
});
// $('.compare__cell_same').hide();
findCompareItemCellMaxHeight();
$('.compare__slider_rukosushki').slick({
infinite: false,
dots: false,
arrows:true,
autoplay: true,
autoplaySpeed:4000,
slidesToShow: 4,
slidesToScroll: 4,
vertical:false,
responsive: [
{
breakpoint: 1281,
settings: {
slidesToShow: 3,
slidesToScroll: 3,
}
},
{
breakpoint: 800,
settings: {
slidesToShow: 2,
slidesToScroll: 2,
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}]
});
$(".butn-buy").click(function()
{
var prod_id = $(this).attr("data-id");
if(prod_id > 0)
{
// alert('ok');
$.ajax({
type: 'POST',
url: '/ajax/add2basket.php',
data: {
"id": prod_id
},
success: function (data) {
// alert('Load was performed.');
$.fancybox.open(data);
},
error:function (data) {
// alert('Load was NOT performed.');
},
});
}
});
$('.buy-button').click(function(e){
e.preventDefault();
var anchor = $(this);
$('html, body').stop().animate({
scrollTop: $(anchor.attr('href')).offset().top
}, 777);
e.preventDefault();
return false;
});
//short compare list or long list
$('.control_delete').click(function() {
$(this).toggleClass('active');
var slideToggleCnt = $(this).parents('.compare').find('.compare__cell_same').length;
$(this).parents('.compare').find('.compare__cell_same').slideToggle('slow',function(){
slideToggleCnt = slideToggleCnt;
if(slideToggleCnt === 0){
findCompareItemCellMaxHeight();
$(document).trigger('resize');
$('html,body').animate({
scrollTop: $(this).parents('.compare').offset().top},
'fast');
}
});
});
//color
$('.colors__item').click(function() {
$('.colors__item').removeClass('active');
$(this).addClass('active');
});
if($(window).width()<769) {
$('.articles').slick({
infinite: true,
dots: false,
slidesToShow: 1,
slidesToScroll: 1
});
}
if($(window).width()<415) {
$('.block__text-images').slick({
infinite: true,
dots: false,
slidesToShow: 2,
slidesToScroll: 2
});
}
if($(window).width()<415) {
$('.block__model').slick({
infinite: true,
dots: false,
slidesToShow: 1,
slidesToScroll: 1
});
}
});
//function to fix compare block cells height
function findCompareItemCellMaxHeight()
{
var maxHeights = [];
setTimeout(function () {
$('.compare').each(function() {
currentCompare = $(this);
for(j=0; j<currentCompare.find('.c-line .compare__cell').length / currentCompare.find('.c-line').length; j++)
{
height = 0;
for(i=0; i < currentCompare.find('.c-line').length; i++)
{
cell = currentCompare.find('.c-line').eq(i).find('.compare__cell').eq(j);
if(cell.is(":visible") === true)
{
if(height < cell.height())
{
height = cell.height();
}
}
}
maxHeights.push(height);
}
currentCompare.find('.compare__cell').each(function(){
var index = $(this).index();
if(maxHeights[index] > 0){
$(this).height(maxHeights[index]);
}
});
});
}, 500);
}