Index: branches/1.0.x/inc/js/jquery.scripts.js =================================================================== diff -u -N -r14770 -r14793 --- branches/1.0.x/inc/js/jquery.scripts.js (.../jquery.scripts.js) (revision 14770) +++ branches/1.0.x/inc/js/jquery.scripts.js (.../jquery.scripts.js) (revision 14793) @@ -95,6 +95,46 @@ return false; } ); + + + $('.addtocart, .button-addtocart').click( + function () { + var $me = $(this), + $qty = $me.attr('qty_id') !== undefined ? parseInt($('#' + $me.attr('qty_id')).val()) : 1; + + + if ( $me.hasClass('addedtocart') ) { + // disabled button + return false; + } + + if ( isNaN($qty) ) { + $qty = 1; + } + + var $bubble = $('.basketStatus'), + $timer_id = $bubble.data('hide_timer'); + + clearTimeout($timer_id); + + $.get( + $me.attr('href') + '&qty=' + $qty, + function ($bubble_content) { + $('.basketContent', $bubble).html( $bubble_content.replace(/#QTY#/g, $qty) ); + $bubble.stop(true, true).fadeIn(); + + var $timer = setTimeout(function(){ $bubble.fadeOut('slow'); }, 2000); + $bubble.data('hide_timer', $timer); + + if ( $me.hasClass('addtocart') ) { + $me.removeClass('addtocart').addClass('addedtocart').html('Added to Cart'); + } + } + ); + + return false; + } + ); }); new DBlocks(); \ No newline at end of file