-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d0bbffc
commit 81abc8c
Showing
3 changed files
with
220 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
(function ($) { | ||
"use strict"; | ||
|
||
// Mobile Navigation | ||
if ($('.main-nav').length) { | ||
var $mobile_nav = $('.main-nav').clone().prop({ | ||
class: 'mobile-nav d-lg-none' | ||
}); | ||
$('body').append($mobile_nav); | ||
$('.navbar').append('<button type="button" class="mobile-nav-toggle d-lg-none"><i class="fa fa-bars"></i></button>'); | ||
$('body').append('<div class="mobile-nav-overly"></div>'); | ||
|
||
$(document).on('click', '.mobile-nav-toggle', function(e) { | ||
$('body').toggleClass('mobile-nav-active'); | ||
$('.mobile-nav-toggle i').toggleClass('fa-times fa-bars'); | ||
$('.mobile-nav-overly').toggle(); | ||
}); | ||
|
||
$(document).on('click', '.mobile-nav .drop-down > a', function(e) { | ||
e.preventDefault(); | ||
$(this).next().slideToggle(300); | ||
$(this).parent().toggleClass('active'); | ||
}); | ||
|
||
$(document).click(function(e) { | ||
var container = $(".mobile-nav, .mobile-nav-toggle"); | ||
if (!container.is(e.target) && container.has(e.target).length === 0) { | ||
if ($('body').hasClass('mobile-nav-active')) { | ||
$('body').removeClass('mobile-nav-active'); | ||
$('.mobile-nav-toggle i').toggleClass('fa-times fa-bars'); | ||
$('.mobile-nav-overly').fadeOut(); | ||
} | ||
} | ||
}); | ||
} else if ($(".mobile-nav, .mobile-nav-toggle").length) { | ||
$(".mobile-nav, .mobile-nav-toggle").hide(); | ||
} | ||
|
||
})(jQuery); | ||
|
Oops, something went wrong.