2016-06-28 15:03:07 +02:00

65 lines
2.2 KiB
Smarty

<script type="text/javascript">
{literal}
function hideExpressCart(event){
if($(".expresscart_frame:visible").length > 0) {
event.data.m.removeClass('active');
$(".expresscart_frame").slideUp();
$(".expresscart_frame").remove();
$('.close_popup_footer').remove();
$("html").unbind("click", hideExpressCart);
initButtons();
}
return false;
}
function showExpressCart(event) {
var m = $(event.target);
m.toggleClass('active');
if($(".expresscart_frame:visible").length > 0) {
m.removeClass('active');
hideFooterExpressCart();
} else {
$(".expresscart_frame").slideDown(function() {
if($(".expresscart_frame").children("p.loading").length > 0) {
var id_product = m.parent().children(".ajax_add_to_cart_product_footer_button").attr("rel");
$(".expresscart_frame").append("<iframe src=\"{/literal}{$base_dir_ssl}{literal}modules/expresscart/ajax.php?page=1&id_product=" + id_product + "\" style=\"display: none;\" border=\"0\" marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" onload=\"$(this).show(); $(this).parent().children('p.loading').remove();\"></iframe>");
}
$(".expresscart_frame").append('<a href="#" class="close_popup_footer"></a>');
$('a.close_popup_footer').click(function() {
$(this).remove();
m.removeClass('active');
hideFooterExpressCart();
return false;
});
$("html").bind("click", {m: m}, hideExpressCart);
});
}
return false;
}
function initButtons() {
$('.slider_sales_product_footer').after("{/literal}<div class=\"expresscart_frame\" style=\"text-align:center;\"><p class=\"loading\"><img src=\"{$img_dir|replace:'"':'"'}ajax-loader.gif\" alt=\"\" /></p></div>{literal}");
}
function hideFooterExpressCart(){
$(".expresscart_frame").slideUp();
$(".expresscart_frame").remove();
$("html").unbind("click", hideExpressCart);
initButtons();
}
$(document).ready(function() {
initButtons();
$("#product").bind("updated", function() {
initButtons();
return false;
});
});
{/literal}
</script>