Skip to content

Instantly share code, notes, and snippets.

@pau1m
Created August 8, 2016 13:54
Show Gist options
  • Save pau1m/5dbe4755a6f740f2fa864c38a2f720da to your computer and use it in GitHub Desktop.
Save pau1m/5dbe4755a6f740f2fa864c38a2f720da to your computer and use it in GitHub Desktop.
giganav
/**
* Setup Main Nav in large screen view
*/
//pjm commented out here
jisc.setupMainNavLarge = function() {
//console.log('main nav large firing');
//$('#search').insertAfter('#nav');
////Wrap submenu div around aside and child of primary nav, to match original jisc structure (retaining existing style)
//$('.j-giganav_primary__item__child').each(function(index, value) {
// $(this).next('aside').andSelf().wrapAll('<div class="submenu"></div>');
//});
//
//$('.j-giganav_primary__item--has-children').each(function(index, value) {
// $(this).children().unwrap();
//});
};
/**
* Setup Main Nav in small screen view
*/
jisc.setupMainNavSmall = function() {
//pjm 3 x lines jquery
$('.masthead__bottom .primary-nav').addClass('j-giganav');
$('.masthead__bottom .primary-nav > ul > li').addClass('j-giganav_primary__item');
$('.j-giganav_primary__item ul').addClass('j-giganav_primary__item__child');
//$('.submenu').children().next('.j-giganav_primary__item__child__grandchild').remove();
$('.j-giganav_primary__item').children('a').wrap('<div class="j-giganav_primary__item--has-children"></div>');
$('.j-giganav_primary__item__child > ul' );
$('.submenu').children().unwrap(); //Remove submenu div
$('.j-giganav_primary__item__child__grandchild').css("display", "none"); //set grandchildren to display none
$('.j-giganav_primary__item__child').css("display", "none"); //set children to display none
$('.secondary-nav').insertAfter('.primary-nav'); //insert secondary nav after primary
$('#search').insertAfter('#combined-nav-wrapper'); //insert search at the bottom of the menu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment