ShowerLoop-cc/docker/showerloop/public/js/app.min.fixed.js

48 lines
1.2 KiB
JavaScript

// App initialization with jQuery check
document.addEventListener('DOMContentLoaded', function() {
function checkJQuery() {
if (window.jQuery) {
// Initialize app functions that depend on jQuery
initializeApp(jQuery);
} else {
setTimeout(checkJQuery, 50);
}
}
checkJQuery();
});
function initializeApp($) {
// Initialize modals
$('.modal-trigger').click(function() {
var target = $(this).data('target');
$('#' + target).addClass('show');
$('body').addClass('modal-open');
});
// Close modals
$('.modal-close').click(function() {
$(this).closest('.modal').removeClass('show');
$('body').removeClass('modal-open');
});
// Initialize tooltips
$('[data-toggle="tooltip"]').each(function() {
var placement = $(this).data('placement') || 'top';
$(this).tooltip({
placement: placement,
trigger: 'hover'
});
});
// Smooth scrolling for anchor links
$('a[href^="#"]').on('click', function(e) {
var target = $(this.getAttribute('href'));
if (target.length) {
e.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top - 100
}, 500);
}
});
}