jquery - Loading javascript after AJAX load -


i have woocommerce site uses light-box products ajax filters. access light box quick-view button appears when hover on product.

when load ajax filter light-box quick-view button no longer clickable. need add code button after ajax load. below function theme uses.

85: function(t, e) {             "use strict";             flatsome.behavior("quick-view", {                 attach: function(t) {                     jquery(".quick-view", t).each(function(t, e) {                         jquery(e).hasclass("quick-view-added") || (jquery(e).click(function(t) {                             if ("" != jquery(this).attr("data-prod")) {                                 jquery(this).parent().parent().addclass("processing");                                 var e = jquery(this).attr("data-prod"),                                     = {                                         action: "flatsome_quickview",                                         product: e                                     };                                 jquery.post(flatsomevars.ajaxurl, i, function(t) {                                     jquery(".processing").removeclass("processing"), jquery.magnificpopup.open({                                         removaldelay: 300,                                         closebtninside: !0,                                         autofocuslast: !1,                                         items: {                                             src: '<div class="product-lightbox lightbox-content">' + t + "</div>",                                             type: "inline"                                         }                                     }), settimeout(function() {                                         jquery(".product-lightbox").imagesloaded(function() {                                             jquery(".product-lightbox .slider").flickity({                                                 cellalign: "left",                                                 wraparound: !0,                                                 autoplay: !1,                                                 prevnextbuttons: !0,                                                 adaptiveheight: !0,                                                 imagesloaded: !0,                                                 dragthreshold: 15                                             })                                         })                                     }, 300), jquery(".product-lightbox form").hasclass("variations_form") && jquery(".product-lightbox form.variations_form").wc_variation_form(), jquery(".product-lightbox form.variations_form").on("show_variation", function(t, e) {                                         e.image.src ? (jquery(".product-lightbox .product-gallery-slider .slide.first img").attr("src", e.image.src).attr("srcset", ""), jquery(".product-lightbox .product-gallery-slider .slide.first a").attr("href", e.image_link), jquery(".product-lightbox .product-gallery-slider").flickity("select", 0)) : e.image_src && (jquery(".product-lightbox .product-gallery-slider .slide.first img").attr("src", e.image_src).attr("srcset", ""), jquery(".product-lightbox .product-gallery-slider .slide.first a").attr("href", e.image_link), jquery(".product-lightbox .product-gallery-slider").flickity("select", 0))                                     }), jquery(".product-lightbox .quantity").addqty()                                 }), t.preventdefault()                             }                         }), jquery(e).addclass("quick-view-added"))                     })                 }             })         } 

if can edit theme, write code directly success callback:

jquery.post(flatsomevars.ajaxurl, i, function(t) {   // code want run   // other code. i.e. jquery(".processing").removeclass ... etc. }); 

or define function , call inside success() callback.

var myfunction = function() {   // code run after success } jquery.post(flatsomevars.ajaxurl, i, function(t) {    myfunction();    // other code }); 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -