Javascript 弹出式购物车工作不正确的bitrix
我试图使弹出购物车,它的显示不正确,首先它的显示弹出,然后更新购物车 我错过了什么 我试过这个Javascript 弹出式购物车工作不正确的bitrix,javascript,jquery,ajax,bitrix,Javascript,Jquery,Ajax,Bitrix,我试图使弹出购物车,它的显示不正确,首先它的显示弹出,然后更新购物车 我错过了什么 我试过这个 <script> BIS.cartPopup = { init: function(container) { var cartPopupLink = $('.buttCart'); var self = this; container.hide();
<script>
BIS.cartPopup = {
init: function(container) {
var cartPopupLink = $('.buttCart');
var self = this;
container.hide();
cartPopupLink.on('click', function(e) {
e.preventDefault();
$.fancybox({
content: container,
afterLoad: function() {
container.show();
}
});
})
}
}
$(function() {
BIS.cartPopup.init($('#popup-cart-wrapper'));
})
</script>
之二{
init:函数(容器){
var cartPopupLink=$('.buttCart');
var self=这个;
container.hide();
cartPopupLink.on('click',函数(e){
e、 预防默认值();
$.fancybox({
内容:容器,
后加载:函数(){
container.show();
}
});
})
}
}
$(函数(){
BIS.cartppopup.init($(“#popup cart wrapper”);
})
这是一个html
<div class="popup__overlay" id="popup-cart-wrapper">
<div class="popup">
//cart inside
</div>
//车内
以下是购物车更新代码:
<script>
if (!BIS.updateTopCart) {
BIS.updateTopCart = {
init: function() {
ajax_block('.top-cart');
ajax_load('.top-cart', '<?=$arResult['AJAX_CALL_ID']?>', $('.top-cart-form').serializeArray());
}
}
}
</script>
如果(!BIS.updateTopCart){
BIS.updateTopCart={
init:function(){
ajax_块(“.top cart”);
ajax_load('.top cart','',$('.top cart form').serializeArray());
}
}
}
您可能需要移动此AJAX代码:
$(function() {
BIS.cartPopup.init($('#popup-cart-wrapper'));
})
到AJAX回调,它在更新购物车后执行此操作:
BIS.updateTopCart = {
init: function() {
ajax_block('.top-cart');
ajax_load('.top-cart', '<?=$arResult['AJAX_CALL_ID']?>', $('.top-cart-form').serializeArray());
$(function() {
BIS.cartPopup.init($('#popup-cart-wrapper'));
})
}
}
BIS.updateTopCart={
init:function(){
ajax_块(“.top cart”);
ajax_load('.top cart','',$('.top cart form').serializeArray());
$(函数(){
BIS.cartppopup.init($(“#popup cart wrapper”);
})
}
}
@front-end\u junior您应该在问题中提到这一点。不管怎样,让我看看!