var newSmallCart = {
data: {
name: '',
phone: '',
defPhone: '',
inn: '',
email: '',
comment: '',
delivery: '',
payment: ''
},
get: function(showCart) {
$.getJSON( "/ajax/cart/get.php", function(data) {
$('.ms2_total_cost').html( data.total_cost );
$('.ms2_total_count').html( data.total_count );
if(data.total_count > 0) {
$('.headMobNew .ch1 .vsbl .rb .cart .ms2_total_count').css('display', 'block');
$('.headNew .l2 .centerNew .cart .cartTop .img .count').css('display', 'block');
} else {
$('.headMobNew .ch1 .vsbl .rb .cart .ms2_total_count').css('display', 'block');
$('.headNew .l2 .centerNew .cart .cartTop .img .count').css('display', 'none');
}
pcount = 0;
str = '
';
products = '';
$.each( data.products, function( k, v ) {
if(v.count > 0) {
pcount++;
products+= '
';
products+= '
';
products+= '
' + v.name + '
' + v.description + '
';
products+= '
';
products+= '
';
products+= '
';
$('.add_to_cart_btn_' + v.id ).html('Добавить еще');
$('.prods_in_cart_count_' + v.id ).val( v.count );
$('.prods_in_cart_remove_' + v.id ).attr('key', v.key);
$('.prods_in_cart_count_' + v.id ).attr('key', v.key);
$('.countList_' + v.id ).css('display','flex');
$('.prods_in_cart_summ_' + v.id ).html(v.sum);
}
});
str+= products;
str+= '
';
str+= '';
priceNum = parseInt(data.total_cost.replace(/\s/g, ''));
priceNumQ = $.cookie('priceNum');
if(priceNum > 20000) {
if(priceNumQ != 1 && priceNumQ != 2) {
$.jGrowl('Ура! Вы собираетесь купить больше чем на 20000 и у вас бесплатная логистика', { life:4000, theme: 'af-message-error' });
$.cookie('priceNum', 1, { expires: 7, path: '/' });
priceNumQ = 2;
}
} else {
if(priceNumQ != 2) {
$.jGrowl('Добавь товар до 20000 и получи бесплатную логистику!', { life:4000, theme: 'af-message-error' });
$.cookie('priceNum', 2, { expires: 7, path: '/' });
priceNumQ = 1;
}
}
if(pcount > 0) {
$( ".newSmallCart" ).html( str );
$( ".bigCartNew .ccontent .rb .products" ).html( products );
} else {
$( ".newSmallCart" ).html('');
$( ".bigCartNew" ).html('Резерв
Перейдите в каталог, чтобы добавить товары в резерв
');
}
if(showCart) $('.newSmallCart').addClass('active');
$.each( data.products, function( k, v ) {
if(v.count > 0) {
$('.count_' + v.key + '_m').on('click', function() {
count = $('.count_' + v.key).val(); count = count - 1;
if(count > 0) {
$('.count_' + v.key).val(count);
}
});
$('.count_' + v.key + '_p').on('click', function() {
count = $('.count_' + v.key).val(); count++;
if(count < 100) {
$('.count_' + v.key).val(count);
}
});
}
});
});
},
add: function(id, count, options, showCart) {
$.getJSON( "/ajax/cart/add.php", { id: id, count: count, options: options } ).done(function( json ) {
if(json.success) {
newSmallCart.get(showCart);
massages = [];
massages.push('Отличный вкус!');
massages.push('Вот ты - красавчик!');
massages.push('А ты классный!');
massages.push('Ну, ничего себе!');
massages.push('Мы тебя любим!');
massages.push('Так держать!');
massages.push('Давай еще!');
massages.push('Вот это уровень!');
massages.push('Уровень "кальянный бог"!');
massages.push('Заявочка на победу!');
massages.push('Огонь!');
massages.push('Шикарный выбор!');
massages.push('Такого резерва у нас еще не было!');
massages.push('Да у тебя там целый список!');
var rand = Math.floor(Math.random() * massages.length);
if(json.price > 10000) $.jGrowl(massages[rand], { life:4000, theme: 'af-message-success' });
} else $.jGrowl( json.message, { life:4000, theme: 'af-message-error' } );
});
},
change: function(elm, n) {
key = elm.attr('key');
count = parseInt($('.count_' + key).val()); count+= n;
if(count > 0 && count < 100) {
$.getJSON( "/ajax/cart/count.php", { key: key, count: count } ).done(function( json ) {
if(json.success) {
newSmallCart.get(false);
} else $.jGrowl( json.message, { life:4000, theme: 'af-message-error' } );
});
}
},
changeVal: function(elm) {
key = elm.attr('key');
count = elm.val();
if(count > 0 && count < 100) {
$.getJSON( "/ajax/cart/count.php", { key: key, count: count } ).done(function( json ) {
if(json.success) {
newSmallCart.get(false);
} else $.jGrowl( json.message, { life:4000, theme: 'af-message-error' } );
});
}
},
remove: function(elm) {
key = elm.attr('key');
$.getJSON( "/ajax/cart/remove.php", { key: key } ).done(function( json ) {
if(json.success) {
newSmallCart.get(false);
} else $.jGrowl( json.message, { life:4000, theme: 'af-message-error' } );
});
},
changeOrRemove: function(id, elm, count) {
count = parseInt(count);
key = elm.attr('key');
if(count > 1) {
count = count - 1;
$.getJSON( "/ajax/cart/count.php", { key: key, count: count } ).done(function( json ) {
if(json.success) {
newSmallCart.get(false);
} else $.jGrowl( json.message, { life:4000, theme: 'af-message-error' } );
});
} else {
$('.prods_in_cart_count_' + id).val(0);
$('.add_to_cart_btn_' + id).html('В резерв');
$('.countList_' + id ).css('display','none');
newSmallCart.remove(elm);
}
},
clean: function() {
$.getJSON( "/ajax/cart/clean.php" ).done(function( json ) {
if(json.success) {
newSmallCart.get(true);
} else $.jGrowl( json.message, { life:4000, theme: 'af-message-error' } );
});
},
addPromo: function() {
$.ajax({
type: "POST",
url: "/ajax/promocode.php",
data: { promocode: $("#promocode").val() }
}).done(function( res ) {
if(res == 0) {
$.jGrowl('Промокод не найден!', { life:4000, theme: 'af-message-error' });
setTimeout(function() { $("#promocode").val(''); }, 500);
} else {
$.jGrowl('Промокод активирован!
Зарегистрируйтесь, и получите Voskoin за каждую покупку!', { life:4000, theme: 'af-message-success' });
setTimeout(function() { location.reload(); }, 4000);
}
});
},
init: function() {
$.getJSON( "/ajax/cart/get.php", function(data) {
$('.ms2_total_cost').html( data.total_cost );
if(data.total_count > 0) $('.headNew .l2 .centerNew .cart .cartTop .img .count').css('display', 'block');
if(data.total_count > 0) $('.headMobNew .ch1 .vsbl .rb .cart .ms2_total_count').css('display', 'block');
$.each( data.products, function( k, v ) {
if(v.count > 0) {
$('.add_to_cart_btn_' + v.id ).html('Добавить еще');
$('.prods_in_cart_count_' + v.id ).val( v.count );
$('.prods_in_cart_remove_' + v.id ).attr('key', v.key);
$('.prods_in_cart_count_' + v.id ).attr('key', v.key);
$('.countList_' + v.id ).css('display','flex');
$('.prods_in_cart_summ_' + v.id ).html(v.sum);
}
});
$('.ms2_total_count').html( data.total_count );
});
$('.headNew .l2 .centerNew .cart .cartTop').on('click', function() {
newSmallCart.get(true);
});
$('.headNew .l2 .centerNew .cart .cartTop').hover(function(){
newSmallCart.get(true);
});
$('.bigCartNew .ccontent .lb .userData .inputs .phone input, .bigCartNew .ccontent .lb .userData .inputs .phone select').on('change', function() {
ch1 = $('.bigCartNew .ccontent .lb .userData .inputs .phone input, .bigCartNew .ccontent .lb .userData .inputs .phone select').val();
ch2 = $('.bigCartNew .ccontent .lb .userData .inputs .phone input, .bigCartNew .ccontent .lb .userData .inputs .phone input').val();
if((ch1 + ch2) == newSmallCart.data.defPhone) {
$('.bigCartNew .ccontent .lb .userData .inputs .phone').addClass('active');
} else {
$('.bigCartNew .ccontent .lb .userData .inputs .phone').removeClass('active');
}
});
$('.bigCartNew .ccontent .lb .userData .next').on('click', function() {
ch1 = $('.bigCartNew .ccontent .lb .userData .inputs .phone input, .bigCartNew .ccontent .lb .userData .inputs .phone select').val();
ch2 = $('.bigCartNew .ccontent .lb .userData .inputs .phone input, .bigCartNew .ccontent .lb .userData .inputs .phone input').val();
newSmallCart.data.phone = ch1 + ch2;
newSmallCart.data.name = $('.bigCartNew .ccontent .lb .userData .inputs .fio').val();
if(!newSmallCart.data.name) {
$.jGrowl('Введите ваше имя!', { life:4000, theme: 'af-message-error' });
return true;
}
newSmallCart.data.inn = $('.bigCartNew .ccontent .lb .userData .inputs .inn').val();
newSmallCart.data.phone = $('.bigCartNew .ccontent .lb .userData .inputs .phone input').val();
if(!newSmallCart.data.phone) {
$.jGrowl('Введите ваш номер телефона!', { life:4000, theme: 'af-message-error' });
return true;
}
newSmallCart.data.email = $('.bigCartNew .ccontent .lb .userData .inputs .email').val();
if(!newSmallCart.data.email) {
$.jGrowl('Введите ваш E-mail!', { life:4000, theme: 'af-message-error' });
return true;
}
newSmallCart.data.comment = $('.bigCartNew .ccontent .lb .userData .inputs .comment').val();
$('.bigCartNew .ccontent .lb .userData').removeClass('active');
$('.bigCartNew .ccontent .lb .delivery').addClass('active');
$('.bigCartNew .ccontent .lb .pay').addClass('active');
$('.bigCartNew .ccontent .lb .delivery .items .btn').on('click', function() {
$('.bigCartNew .ccontent .lb .delivery .items .btn').removeClass('active');
$(this).addClass('active');
newSmallCart.data.delivery = $(this).attr('mid');
});
$('.bigCartNew .ccontent .lb .pay .items .btn').on('click', function() {
$('.bigCartNew .ccontent .lb .pay .items .btn').removeClass('active');
$(this).addClass('active');
newSmallCart.data.payment = $(this).attr('mid');
});
});
window.oformleniest = false;
$('.bigCartNew .ccontent .rb .cBottom .btns .oformit').on('click', function() {
/*if(!newSmallCart.data.delivery) {
$.jGrowl('Выберите способ логистики!', { life:4000, theme: 'af-message-error' });
return true;
}*/
newSmallCart.data.delivery = 3;
/*if(!newSmallCart.data.payment) {
$.jGrowl('Выберите способ оплаты!', { life:4000, theme: 'af-message-error' });
return true;
}*/
newSmallCart.data.payment = 1;
newSmallCart.data.name = $('.bigCartNew .ccontent .lb .userData .inputs .fio').val();
if(!newSmallCart.data.name) {
$.jGrowl('Введите ваше имя!', { life:4000, theme: 'af-message-error' });
return true;
}
newSmallCart.data.inn = $('.bigCartNew .ccontent .lb .userData .inputs .inn').val();
newSmallCart.data.email = $('.bigCartNew .ccontent .lb .userData .inputs .email').val();
if(!newSmallCart.data.email) {
$.jGrowl('Введите ваш E-mail!', { life:4000, theme: 'af-message-error' });
return true;
}
newSmallCart.data.phone = $('.bigCartNew .ccontent .lb .userData .inputs .phone input').val();
if(!newSmallCart.data.phone) {
$.jGrowl('Укажите ваш телефон!', { life:4000, theme: 'af-message-error' });
return true;
}
if(!window.oformleniest) {
window.oformleniest = true;
newSmallCart.data.comment = $('.bigCartNew .ccontent .lb .userData .inputs .comment').val();
$('.main').css('opacity','0.3');
$('.cartLoadingNew').css('display','flex');
$.get( "/ajax/cart/order.php", {
receiver: newSmallCart.data.name,
inn: newSmallCart.data.inn,
email: newSmallCart.data.email,
comment: newSmallCart.data.comment,
phone: newSmallCart.data.phone,
delivery: newSmallCart.data.delivery,
payment: newSmallCart.data.payment,
city: $('.bigCartNew .ccontent .lb .delivery .dcity .sity').val(),
adres: $('.bigCartNew .ccontent .lb .delivery .dcity .adres').val()
}).done(function(data) {
$('.main').css('opacity','1');
$('.cartLoadingNew').css('display','none');
console.log(data);
// data = $.parseJSON(data);
// data = $.parseJSON(data);
if(data.success) {
location.href = '/korzina/result?oid=' + data.data.msorder;
} else {
window.oformleniest = false;
if(data.action == "login") data.message = 'Авторизуйтесь на сайте под номером ' + newSmallCart.data.phone;
$.jGrowl( data.message, { life:4000, theme: 'af-message-error' });
}
});
}
});
$('.bigCartNew .ccontent .lb .userData .inputs .pnpsms2').on('click', function() {
ch1 = $('.bigCartNew .ccontent .lb .userData .inputs .phone input, .bigCartNew .ccontent .lb .userData .inputs .phone select').val();
ch2 = $('.bigCartNew .ccontent .lb .userData .inputs .phone input, .bigCartNew .ccontent .lb .userData .inputs .phone input').val();
number = ch1 + ch2;
$.getJSON( "/assets/smsru/sendSMS.php?number=" + number, function( data ) {
if(!data.res) {
if(data.code == 1) {
if(data.notUser == 1) {
$('.bigCartNew .ccontent .lb .userData .inputs .phone').addClass('active');
newSmallCart.data.phone = number;
} else {
smsLogin.send( number );
$('.bigCartNew .ccontent .lb .userData .inputs .phone').addClass('active');
newSmallCart.data.phone = number;
}
} else {
$.jGrowl(data.title, { life:4000, theme: 'af-message-error' });
}
} else {
$('#confirmNumber').val(number);
$.fancybox.open({
src : '#confirmNumber',
type : 'inline'
});
}
});
});
$('.prods_in_cart_count').on('change', function() {
key = $(this).attr('key');
count = $(this).val();
if(count > 0 && count < 100) {
$.getJSON( "/ajax/cart/count.php", { key: key, count: count } ).done(function( json ) {
if(json.success) {
newSmallCart.get(false);
} else {
$.jGrowl( json.message, { life:4000, theme: 'af-message-error' } );
newSmallCart.get(false);
}
});
} else newSmallCart.get(false);
});
}
}
function pamess2() {
document.getElementById('uvedomlenie2').style.display='none';
$.get( "/ajax/covmsg.php?num=2" );
}
var votes = {
send: function(id) {
$.getJSON( "/ajax/vote/send.php", { id: id } ).done(function( json ) {
if(json.result) {
$.jGrowl('Вы успешно проголосовали!', { life:4000, theme: 'af-message-success' });
document.location.reload(true);
} else {
$.jGrowl( json.massage, { life:4000, theme: 'af-message-error' } );
}
});
}
};
var addToFavoriteC = function(elm, id) {
$.ajax({
url: '/ajax/addFav.php?id=' + id,
success: function(data) {
if(data == 'fav') {
elm.addClass('active');
} else {
elm.removeClass('active');
}
}
});
}
$.fn.setCursorPosition = function(pos) {
this.each(function(index, elem) {
if (elem.setSelectionRange) {
elem.setSelectionRange(pos, pos);
} else if (elem.createTextRange) {
var range = elem.createTextRange();
range.collapse(true);
range.moveEnd('character', pos);
range.moveStart('character', pos);
range.select();
}
});
return this;
};
$( document ).ready(function() {
$('.nTovSlyder .nTovSlyde .nTovCard .nTOvLb .nTovMini .nTovMiniImg').on('click', function() {
$('.nTovSlyder .nTovSlyde .nTovCard .nTOvLb .nTovImg').attr('href', $(this).attr('data-image'));
$('.nTovSlyder .nTovSlyde .nTovCard .nTOvLb .nTovImg img').attr('src', $(this).attr('data-image'));
jQuery(function($){
$('a.zoom').easyZoom();
});
});
$('.nTovSlyder .nTovSlyde').css('opacity','1');
var product = $('#articleId').val();
$('.nTovSlyder .left, .nTovMob .line3 .prev').on('click', function() {
$.get( "/ajax/getProductUrl.php", { direction: "prev", id: product } )
.done(function( data ) {
window.location.href = data;
});
$('.nTovSlyder .nTovSlyde').css('opacity','0.1');
});
$('.nTovSlyder .right, .nTovMob .line3 .next').on('click', function() {
$.get( "/ajax/getProductUrl.php", { direction: "next", id: product } )
.done(function( data ) {
window.location.href = data;
});
$('.nTovSlyder .nTovSlyde').css('opacity','0.1');
});
$('.headNew .l2 .centerNew .menuNew a.cbtn').hover(function(){
num = $(this).attr('num');
$('.catalogVipadushka').removeClass('active');
$('.headNew .l2 .centerNew .menuNew a.cbtn').removeClass('active');
if($(this).hasClass('active')) {
$('.catalogVipadushka_' + num).removeClass('active');
} else {
$(this).addClass('active');
$('.catalogVipadushka_' + num).addClass('active');
$('.catalogVipadushka.active').on('mouseleave', function(){
$('.catalogVipadushka.active, .headNew .l2 .centerNew .menuNew a.active').removeClass('active');
});
}
});
jQuery(function($){
$(document).mouseup(function (e){
var catalogVipadushka = $(".catalogVipadushka");
if (!catalogVipadushka.is(e.target)
&& catalogVipadushka.has(e.target).length === 0
&& catalogVipadushka.hasClass('active')) {
$('.headNew .l2 .centerNew .menuNew a.cbtn').removeClass('active');
catalogVipadushka.removeClass('active');
}
var newSmallCart = $('.newSmallCart');
if (!newSmallCart.is(e.target)
&& newSmallCart.has(e.target).length === 0
&& newSmallCart.hasClass('active')) {
newSmallCart.removeClass('active');
}
});
});
newSmallCart.init();
$('.headMobNew .ch1 .vsbl .lb .openMenu').on('click', function() {
if($('.headMobNew .ch1').hasClass('active')) {
$('.headMobNew .ch1').removeClass('active');
$('.headMobNew').removeClass('opn');
} else {
$('.headMobNew .ch2').removeClass('active');
$('.headMobNew .ch1').addClass('active');
$('.headMobNew').addClass('opn');
}
});
$('.headMobNew .ch2 .vsbl .lb .openMenu, .headMobNew .ch2 .vsbl .lb .katalogt').on('click', function() {
if($('.headMobNew .ch2').hasClass('active')) {
$('.headMobNew .ch2').removeClass('active');
$('.headMobNew').removeClass('opn');
} else {
$('.headMobNew .ch1').removeClass('active');
$('.headMobNew .ch2').addClass('active');
$('.headMobNew').addClass('opn');
}
});
$('.headMobNew .ch2 .nvsbl .mobSpMenu .elm .childLvl2, .headMobNew .ch2 .nvsbl .mobSpMenu .elm .childLvl2 .elm .childLvl3').each(function( index ) {
if($(this).html() == '') {
$(this).prev().children(".rBtn").remove();
}
});
$('.catalog_wrp .leftSyde .category_menu .elm .l .rBtn').addClass('v');
$('.headMobNew .ch2 .nvsbl .mobSpMenu > .elm > .l > .rBtn').on('click', function() {
//$('.headMobNew .ch2 .nvsbl .mobSpMenu > .elm').removeClass('open');
if($(this).html() == '+') {
$(this).closest('.elm').addClass('open');
//$('.headMobNew .ch2 .nvsbl .mobSpMenu > .elm .l .rBtn').html('+');
$(this).html('-');
} else {
$(this).closest('.elm').removeClass('open');
$(this).html('+');
}
});
$('.headMobNew .ch2 .nvsbl .mobSpMenu > .elm > .childLvl2 > .elm > .l > .rBtn').on('click', function() {
//$('.headMobNew .ch2 .nvsbl .mobSpMenu > .elm > .childLvl2 > .elm').removeClass('open');
if($(this).html() == '+') {
$(this).closest('.elm').addClass('open');
//$('.headMobNew .ch2 .nvsbl .mobSpMenu > .elm > .childLvl2 > .elm .rBtn').html('+');
$(this).html('-');
} else {
$(this).closest('.elm').removeClass('open');
$(this).html('+');
}
});
$('.catalog_wrp .leftSyde .category_menu .elm .childLvl2, .catalog_wrp .leftSyde .category_menu .elm .childLvl2 .childLvl3').each(function( index ) {
if($(this).html() == '') {
$(this).prev().children(".rBtn").remove();
}
});
$('.catalog_wrp .leftSyde .category_menu .vpmenu').each(function( index ) {
if($(this).html() == '') {
$(this).prev().remove();
}
});
$('.catalog_wrp .leftSyde .category_menu > .vpmenu > .elm > .l > .rBtn').on('click', function() {
//$('.catalog_wrp .leftSyde .category_menu > .vpmenu > .elm').removeClass('open');
if($(this).html() == '+') {
$(this).closest('.elm').addClass('open');
//$('.catalog_wrp .leftSyde .category_menu > .vpmenu > .elm .l .rBtn').html('+');
$(this).html('-');
} else {
$(this).closest('.elm').removeClass('open');
$(this).html('+');
}
});
$('.catalog_wrp .leftSyde .category_menu > .vpmenu > .elm > .childLvl2 > .elm > .l > .rBtn').on('click', function() {
//$('.catalog_wrp .leftSyde .category_menu > .vpmenu > .elm > .childLvl2 > .elm').removeClass('open');
if($(this).html() == '+') {
$(this).closest('.elm').addClass('open');
//$('.catalog_wrp .leftSyde .category_menu > .vpmenu > .elm > .childLvl2 > .elm .rBtn').html('+');
$(this).html('-');
} else {
$(this).closest('.elm').removeClass('open');
$(this).html('+');
}
});
$('.catalog_wrp .leftSyde .category_menu .mobh').on('click', function() {
if($('.catalog_wrp .leftSyde .category_menu').hasClass('open')) {
$(this).parent(".category_menu").removeClass('open');
} else {
$(this).parent(".category_menu").addClass('open');
}
});
$('.catalog_wrp .leftSyde .catalog_menu .mobh').on('click', function() {
if($('.catalog_wrp .leftSyde .catalog_menu').hasClass('open')) {
$(this).parent(".catalog_menu").removeClass('open');
} else {
$(this).parent(".catalog_menu").addClass('open');
}
});
$('.card.magaziniCard .text__wrp .vipadushki .elm .h').on('click', function() {
if($(this).parent(".elm").hasClass('active')) {
$(this).parent(".elm").removeClass('active');
$(this).children( ".s" ).html("+");
} else {
$(this).parent(".elm").addClass('active');
$(this).children( ".s" ).html("-");
}
});
$('.nTovMob .tocart .count .minus').on('click', function() {
count = parseInt($('.nTovMob .tocart .count .num').html()); count = count - 1;
if(count > 0) {
$('.nTovMob .tocart .count .num').html(count);
}
});
$('.nTovMob .tocart .count .plus').on('click', function() {
count = parseInt($('.nTovMob .tocart .count .num').html()); count++;
if(count < 100) {
$('.nTovMob .tocart .count .num').html(count);
}
});
/*$('.nTovSlyder .nTovSlyde .nTovCard .nTovRb .btns .count .minus').on('click', function() {
count = parseInt($('.nTovSlyder .nTovSlyde .nTovCard .nTovRb .btns .count .num').val()); count = count - 1;
if(count > 0) {
$('.nTovSlyder .nTovSlyde .nTovCard .nTovRb .btns .count .num').val(count);
}
});
$('.nTovSlyder .nTovSlyde .nTovCard .nTovRb .btns .count .plus').on('click', function() {
count = parseInt($('.nTovSlyder .nTovSlyde .nTovCard .nTovRb .btns .count .num').val()); count++;
if(count < 100) {
$('.nTovSlyder .nTovSlyde .nTovCard .nTovRb .btns .count .num').val(count);
}
});*/
$('#mse2_results .spiscom .count .minus').on('click', function() {
num = $(this).attr('num');
count = parseInt($('#mse2_results .spiscom .count .count_' + num).val()); count = count - 1;
price = parseInt($('#mse2_results .spiscom .count .count_' + num).attr('price'));
if(count > 0) {
$('#mse2_results .spiscom .count .count_' + num).val(count);
$('#mse2_results .spiscom .summ_' + num).html(count*price);
}
});
$('#mse2_results .spiscom .count .plus').on('click', function() {
num = $(this).attr('num');
count = parseInt($('#mse2_results .spiscom .count .count_' + num).val()); count++;
price = parseInt($('#mse2_results .spiscom .count .count_' + num).attr('price'));
if(count < 100) {
$('#mse2_results .spiscom .count .count_' + num).val(count);
$('#mse2_results .spiscom .summ_' + num).html(count*price);
}
});
$('#mse2_results .spiscom .count input[type="text"]').on('change', function() {
num = $(this).attr('num');
count = parseInt($('#mse2_results .spiscom .count .count_' + num).val());
price = parseInt($('#mse2_results .spiscom .count .count_' + num).attr('price'));
$('#mse2_results .spiscom .summ_' + num).html(count*price);
});
$('.nTovMob .tocart .tocartBtn').on('click', function() {
newSmallCart.add($('#resId').val(), 1, '', false);
});
$('.main .zakazOformlen .content .slyder .left').on('click', function() {
$('.main .zakazOformlen .content .slyder .items').animate({
scrollLeft: '-=400',
}, 1000, function() {
//код по завершении анимации
});
});
$('.main .zakazOformlen .content .slyder .right').on('click', function() {
$('.main .zakazOformlen .content .slyder .items').animate({
scrollLeft: '+=400',
}, 1000, function() {
//код по завершении анимации
});
});
$('#vivodspiskom').click(function(){
if ($(this).is(':checked')){
$.cookie('vivodspiskom', 1, { expires: 7, path: '/' });
} else {
$.cookie('vivodspiskom', 2, { expires: 7, path: '/' });
}
document.location.reload(true);
});
var calcScrollTop = function() {
if($( window ).scrollTop() > 120) {
if(!$('.headNew').hasClass('scrolled')) {
$('.headNew').css('margin-top', '-4vw');
$('.headNew').animate({ marginTop: '0vw' }, 150, "linear");
}
$('.headNew, .newSmallCart, .catalogVipadushka').addClass('scrolled');
} else {
$('.headNew, .newSmallCart, .catalogVipadushka').removeClass('scrolled');
}
}
$( window ).scroll(function() {
calcScrollTop();
});
calcScrollTop();
$('.headMobNew .ch2 .nvsbl .mobSpMenu .elm .l a').click(function(){
$(this).css('color','#ffd100');
});
$( ".newSmallCart" )
.mouseenter(function() {
$('.newSmallCart.active').addClass('active');
})
.mouseleave(function() {
$('.newSmallCart.active').removeClass('active');
});
});