| 1 |
; (function ($, elementor) { |
| 2 |
$(window).on('elementor/frontend/init', function () { |
| 3 |
let ModuleHandler = elementorModules.frontend.handlers.Base, |
| 4 |
ShippingForm |
| 5 |
ShippingForm = ModuleHandler.extend({ |
| 6 |
bindEvents: function () { |
| 7 |
this.run() |
| 8 |
}, |
| 9 |
run: function (key) { |
| 10 |
var element = this.findElement('.elementor-widget').get(0); |
| 11 |
if (jQuery(this.$element).hasClass('elementor-section')) { |
| 12 |
element = this.$element.get(0) |
| 13 |
} |
| 14 |
var $container = this.$element.find(".usk-page-checkout"); |
| 15 |
if (!$container.length) { |
| 16 |
return; |
| 17 |
} |
| 18 |
var usk_shipping_form = { |
| 19 |
$checkout_form: $('.usk-page-checkout'), |
| 20 |
init: function () { |
| 21 |
this.$checkout_form.on('change', '#ship-to-different-address input', this.ship_to_different_address); |
| 22 |
this.$checkout_form.find('#ship-to-different-address input').trigger('change'); |
| 23 |
}, |
| 24 |
ship_to_different_address: function () { |
| 25 |
$('div.shipping_address').hide(); |
| 26 |
if ($(this).is(':checked')) { |
| 27 |
$('div.shipping_address').slideDown(); |
| 28 |
} |
| 29 |
}, |
| 30 |
}; |
| 31 |
usk_shipping_form.init(); |
| 32 |
} |
| 33 |
}) |
| 34 |
elementorFrontend.hooks.addAction( |
| 35 |
'frontend/element_ready/usk-page-checkout.default', |
| 36 |
function ($scope) { |
| 37 |
elementorFrontend.elementsHandler.addHandler(ShippingForm, { |
| 38 |
$element: $scope |
| 39 |
}) |
| 40 |
} |
| 41 |
) |
| 42 |
}) |
| 43 |
})(jQuery, window.elementorFrontend) |
| 44 |
|