Skip to content

Instantly share code, notes, and snippets.

@firatoezcan
Created November 16, 2018 20:14
Show Gist options
  • Save firatoezcan/7210e6551930863ca2870cd61f162edf to your computer and use it in GitHub Desktop.
Save firatoezcan/7210e6551930863ca2870cd61f162edf to your computer and use it in GitHub Desktop.
The previous code of the dynamic navigation generation
function screenClass() {
if ($(window).innerWidth() < 725) {
// getting the data from the navigation
var subNav = '<div id="subNavigation">' + navData + '</div>';
if (!$('#subnavigation').length) {
$('#content').prepend(subNav);
$('#content').css("padding-left", "0px");
$('.col-left ul:first').clone().appendTo('#subnavigation');
$('#subnavigation').click(function () {
$('#subnavigation i').toggleClass('fa-chevron-down fa-chevron-up');
$('#subnavigation ul:first').slideToggle('slow');
});
$('.col-left').hide();
}
} else {
$('.col-left').show();
$('#content').css("padding-left", "25%");
$('#subNav').remove();
}
}
$(window).bind('resize', function () {
screenClass();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment