Repellent
8 years ago
1 changed files with 86 additions and 0 deletions
@ -0,0 +1,86 @@
|
||||
<!-- |
||||
$().ready(function() { |
||||
//Функция замирания экрана
|
||||
function block_page(){ |
||||
$.blockUI({ |
||||
message: '<img src="'+avemediapath+'/images/loader-12.gif" alt="" />', |
||||
css: { |
||||
top: ($(window).height() - 30) /2 + 'px',
|
||||
left: ($(window).width() - 30) /2 + 'px',
|
||||
width: '30px', |
||||
border: 'none', |
||||
padding: '15px', |
||||
backgroundColor: '#000', |
||||
'-webkit-border-radius': '10px', |
||||
'-moz-border-radius': '10px', |
||||
'border-radius': '10px', |
||||
opacity: .5, |
||||
color: '#fff' |
||||
} |
||||
}); |
||||
}; |
||||
|
||||
//Удалить из корзины
|
||||
$("#basket li img").live('click', function(){ |
||||
block_page(); |
||||
//$("#basket .ajax-loader").show();
|
||||
var pid = $(this).attr('id').split('_'); |
||||
$.post(aveabspath, |
||||
{module: "basket", action: "delete", id: pid[1]}, |
||||
function(response) { |
||||
$("#basket").before(response).remove(); |
||||
setTimeout($.unblockUI, 100); |
||||
}); |
||||
return false; |
||||
}); |
||||
|
||||
//Добавить в корзину - only link
|
||||
$('a.addCart').live('click', function(){ |
||||
block_page(); |
||||
var data = $(this).attr('id').split('-'); |
||||
$.post(aveabspath, |
||||
{module: "basket", action: "add", p_id: data[0], p_name: data[1], p_price: data[2], p_article: data[3], p_size: data[4], quantity: "1"}, |
||||
function(response) { |
||||
$("#basket").before(response).remove(); |
||||
setTimeout($.unblockUI, 100); |
||||
}); |
||||
return false; |
||||
}); |
||||
|
||||
//Добавить в корзину
|
||||
$(".product").submit(function(e) { |
||||
e.preventDefault(); |
||||
$(this).ajaxSubmit({ |
||||
type: "post", |
||||
resetForm: true, |
||||
beforeSubmit: function(formData, jqForm) { |
||||
$("#basket .ajax-loader").show(); |
||||
var productImage = jqForm.find(".product-image"); |
||||
var imagePosition = productImage.offset(); |
||||
var basketPosition = $("#basket").offset(); |
||||
productImage.before('<img src="' + productImage.attr("src") |
||||
+ '" class="fly-image" style="position: absolute; top: ' |
||||
+ imagePosition.top + 'px; left: ' |
||||
+ imagePosition.left + 'px;" />'); |
||||
$(".fly-image").animate({ |
||||
top: basketPosition.top + 'px', |
||||
left: basketPosition.left + 'px', |
||||
opacity: 0, |
||||
width: $("#basket").width(), |
||||
heigth: $("#basket").height()}, |
||||
"slow", |
||||
false, |
||||
function(){ |
||||
$(".fly-image").remove(); |
||||
}); |
||||
}, |
||||
success: function(response) { |
||||
$("#basket").before(response).remove() |
||||
.find(".ajax-loader").hide(); |
||||
} |
||||
}); |
||||
return false; |
||||
}); |
||||
|
||||
}); |
||||
--> |
Loading…
Reference in new issue