I try to make popup cart, it's display incorrect, first it's display popup, and then update cart what I missed?
I tried this
<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>
here is a html
<div class="popup__overlay" id="popup-cart-wrapper">
<div class="popup">
//cart inside
</div>
and here is a cart update code:
<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>
You might need to move this AJAX code:
To the AJAX call back, which does it after the cart is updated: