Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AJAX加载后加载javascript_Javascript_Jquery_Ajax_Wordpress - Fatal编程技术网

AJAX加载后加载javascript

AJAX加载后加载javascript,javascript,jquery,ajax,wordpress,Javascript,Jquery,Ajax,Wordpress,我有一个woocommerce网站,它使用带有AJAX过滤器的灯箱产品。 要访问灯箱,当您将鼠标悬停在产品上时,将显示“快速查看”按钮 加载AJAX过滤器时,灯箱快速查看按钮不再可单击。 我需要在AJAX加载之后将代码添加到按钮。 下面是主题使用的函数 85: function(t, e) { "use strict"; Flatsome.behavior("quick-view", { attach: functi

我有一个woocommerce网站,它使用带有AJAX过滤器的灯箱产品。 要访问灯箱,当您将鼠标悬停在产品上时,将显示“快速查看”按钮

加载AJAX过滤器时,灯箱快速查看按钮不再可单击。 我需要在AJAX加载之后将代码添加到按钮。 下面是主题使用的函数

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"),
                                    i = {
                                        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"))
                    })
                }
            })
        }
85:函数(t,e){
“严格使用”;
Flatsome.behavior(“快速查看”{
附:功能(t){
jQuery(“.quick view”,t)。每个(函数(t,e){
jQuery(e).hasClass(“添加的快速查看”)| |(jQuery(e).单击(函数(t){
如果(“!=jQuery(this).attr(“数据产品”)){
jQuery(this.parent().parent().addClass(“处理”);
var e=jQuery(this).attr(“数据产品”),
i={
动作:“flatsome_quickview”,
产品:e
};
post(flatsomeVars.ajaxurl,i,function(t){
jQuery(“.processing”).removeClass(“processing”),jQuery.magnificpoop.open({
拆除延迟:300,
CloseBtnSide:!0,
自动聚焦last:!1,
项目:{
src:“+t+”,
类型:“内联”
}
}),setTimeout(函数(){
jQuery(“.product lightbox”).imagesLoaded(函数(){
jQuery(“.product lightbox.slider”).flickity({
cellAlign:“左”,
总括:!0,
自动播放:!1,
prevNextButtons:!0,
自适应高度:!0,
imagesLoaded:!0,
牵引阈值:15
})
})
},300),jQuery(“.product lightbox form”).hasClass(.variations_form”)&&jQuery(.product lightbox form.variations_form”).wc_variations_form(),jQuery(.product lightbox form.variations_form”)。on(“show_variations”(显示变化),函数(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\u link),jQuery(.product lightbox.product gallery slider slider”).flick(.flickity(“选择”,0)):e.image\u src&(jQuery)(“.product lightbox.product gallery slider.slide.first img”).attr(“src”,e.image\u src).attr(“srcset”,”),jQuery(“product lightbox.product gallery slider.slide.first a”).attr(“href”,e.image\u链接),jQuery(“product lightbox.product gallery slider”).flickity(“选择”,0))
}),jQuery(“.product lightbox.quantity”).addQty()
}),t.preventDefault()
}
}),jQuery(e).addClass(“添加的快速查看”))
})
}
})
}

如果可以编辑主题,请将代码直接写入成功回调:

jQuery.post(flatsomeVars.ajaxurl, i, function(t) {
  // Code you want to run
  // Other code. i.e. jQuery(".processing").removeClass ... etc.
});
或者定义函数并在success()回调中调用它

var myFunction = function() {
  // Code to run after success
}
jQuery.post(flatsomeVars.ajaxurl, i, function(t) {
   myFunction();
   // Other code
});

非常感谢我所需要的,问题是我真的不确定我必须运行什么代码,正在处理它!