Harmony/main/static/deps/js/jquery-events.js

35 lines
1.3 KiB
JavaScript
Raw Normal View History

2024-02-19 05:43:38 +00:00
// Когда html документ готов (прорисован)
$(document).ready(function () {
// Берем из разметки элемент по id - оповещения от django
var notification = $('#notification');
// И через 7 сек. убираем
if (notification.length > 0) {
setTimeout(function () {
notification.alert('close');
}, 7000);
}
// При клике по значку корзины открываем всплывающее(модальное) окно
$('#modalButton').click(function () {
$('#exampleModal').appendTo('body');
$('#exampleModal').modal('show');
});
// Собыите клик по кнопке закрыть окна корзины
$('#exampleModal .btn-close').click(function () {
$('#exampleModal').modal('hide');
});
// Обработчик события радиокнопки выбора способа доставки
$("input[name='requires_delivery']").change(function() {
var selectedValue = $(this).val();
// Скрываем или отображаем input ввода адреса доставки
if (selectedValue === "1") {
$("#deliveryAddressField").show();
} else {
$("#deliveryAddressField").hide();
}
});
});