0

Здравствуйте мне нужно добавить анимацию загрузки в функцию которая срабатывает после того как кликнули на кнопку

вот сама функция

function get_revpopup_cart( product_id, action, quantity ) {
    quantity = typeof(quantity) != 'undefined' ? quantity : 1;
    if ( action == "catalog" ) {
        $.ajax({
            url: 'index.php?route=checkout/cart/add',
            type: 'post',
            data: 'product_id=' + product_id + '&quantity=' + quantity,
            dataType: 'json',

        beforeSend: function(){
            $('body').addClass('blur2');
            $('#pagefader2').fadeIn(70);
        },
   .............

вот анимация загрузки <div class="page_gif_progress_icon"><div class="circle"></div></div>

кнопка: <a onclick="get_revpopup_cart('103', 'catalog', '1');" data-toggle="tooltip" title="В корзину"><i class="fa fa-border fa-shopping-basket"><span class="prlistb">add in cart</span></i>

анимация должна появиться перед $('body').addClass('blur2'); и пропасть после того как функция будет выполнена

спасибо

1 ответ 1

0
function get_revpopup_cart( product_id, action, quantity ) {
    quantity = typeof(quantity) != 'undefined' ? quantity : 1;
    if ( action == "catalog" ) {
        $.ajax({
            url: 'index.php?route=checkout/cart/add',
            type: 'post',
            data: 'product_id=' + product_id + '&quantity=' + quantity,
            dataType: 'json',

        beforeSend: function(){

            $('body').append('<div class="page_gif_progress_icon"><div class="circle"></div></div>').addClass('blur2');
            $('#pagefader2').fadeIn(70);
        },

И в обработке результата добавить:

$(".page_gif_progress_icon").remove();
1
  • Прям то, что нужно! огромное спасибо!
    – Yury R
    14 авг 2016 в 14:59

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.