Skip to content

Instantly share code, notes, and snippets.

@wplit
Last active March 2, 2021 10:47
Show Gist options
  • Select an option

  • Save wplit/56fdc7d7f0c7d6dc075862fbc22b3aa2 to your computer and use it in GitHub Desktop.

Select an option

Save wplit/56fdc7d7f0c7d6dc075862fbc22b3aa2 to your computer and use it in GitHub Desktop.
allow burger trigger to be toggle for modal (add to code block) remember to remove the trigger from the modal settings
jQuery(document).ready(function($) {
let clickTrigger = '.trigger'; /* The class you give the burger trigger */
let modalSelector = '.my-modal'; /* The class you give the modal */
function showModal(modal) {
var $modal = jQuery(modal);
$modal.addClass("live");
$modal.css("display", "flex");
$modal.hide();
$modal.find(".aos-animate").removeClass("aos-animate").addClass("aos-animate-disabled");
$modal.fadeIn(250, function() {
$modal.find(".aos-animate-disabled").removeClass("aos-animate-disabled").addClass("aos-animate");
});
}
window.showModal = showModal;
if (typeof oxyCloseModal !== 'undefined') {
$(clickTrigger).off('click');
$(document).on('click', clickTrigger, function() {
if ($(this).children('.hamburger').data('animation') !== 'disable') {
$(this).children('.hamburger').toggleClass('is-active');
}
if ($(modalSelector).is(":visible")) {
oxyCloseModal($(modalSelector).closest('.oxy-modal-backdrop'));
} else {
showModal($(modalSelector).closest('.oxy-modal-backdrop'));
}
})
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment