$('.header_items li:has(ul)').addClass('parent'); $('.burger-icon a').click(function() { if ($(document).find('.nav').hasClass('active')){ $(document).find('.nav').removeClass('active'); $('body').toggleClass('mobile-open'); $('.header_items li.parent ul').slideUp(250); $('a.child-triggerm').removeClass('child-open'); } else { $(document).find('.nav').addClass('active'); } $('body').toggleClass('mobile-open'); $('.header_items li.parent .sub-menu li').removeClass('child-open'); $('.header_items li.parent ul').slideUp(250); return false; }); $('.header_items li.parent ul').before('<a class="child-triggerm"><span></span></a>'); $('.header_items a.child-triggerm').click(function() { $(this).parent().siblings('li').find('a.child-triggerm').removeClass('child-open'); $(this).parent().siblings('li').find('ul').slideUp(250); $(this).next('ul').slideToggle(250); $(this).toggleClass('child-open'); return false; }); function StickyHeader() { var headerHeight = jQuery('#header').innerHeight(); jQuery('body').css("padding-top", headerHeight); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter