Skip to content

Instantly share code, notes, and snippets.

@ckozus
Created March 17, 2016 12:14
Show Gist options
  • Save ckozus/48b3fecbbe55e1f9c4e9 to your computer and use it in GitHub Desktop.
Save ckozus/48b3fecbbe55e1f9c4e9 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
var menuToggle = $('#js-mobile-menu').unbind();
$('#js-navigation-menu').removeClass("show");
menuToggle.on('click', function(e) {
e.preventDefault();
$('#js-navigation-menu').slideToggle(function(){
if($('#js-navigation-menu').is(':hidden')) {
$('#js-navigation-menu').removeAttr('style');
}
});
});
$(".dropdown-button").click(function() {
var $button, $menu;
$button = $(this);
$menu = $button.siblings(".dropdown-menu");
$menu.toggleClass("show-menu");
$menu.children("li").click(function() {
$menu.removeClass("show-menu");
$button.html($(this).html());
});
});
$('.accordion-tabs').each(function(index) {
$(this).children('li').first().children('a').addClass('is-active').next().addClass('is-open').show();
});
$('.accordion-tabs').on('click', 'li > a.tab-link', function(event) {
if (!$(this).hasClass('is-active')) {
event.preventDefault();
var accordionTabs = $(this).closest('.accordion-tabs');
accordionTabs.find('.is-open').removeClass('is-open').hide();
$(this).next().toggleClass('is-open').toggle();
accordionTabs.find('.is-active').removeClass('is-active');
$(this).addClass('is-active');
} else {
event.preventDefault();
}
});
$("#modal-1").on("change", function() {
if ($(this).is(":checked")) {
$("body").addClass("modal-open");
} else {
$("body").removeClass("modal-open");
}
});
$(".modal-fade-screen, .modal-close").on("click", function() {
$(".modal-state:checked").prop("checked", false).change();
});
$(".modal-inner").on("click", function(e) {
e.stopPropagation();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment