Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container">
  <div class="row">
    <div class="sf-contener clearfix col-lg-12" id="block_top_menu">
      <div class="cat-title">Categories</div>
      <ul class="sf-menu clearfix menu-content">
        <li><span class="menu-mobile-grover"></span><a title="BABY &amp; CHILD CARE" href="#" class="">BABY &amp; CHILD CARE</a>
          <ul class="submenu-container clearfix first-in-line-xs menu-mobile">
            <li><a title="Aliquam congue" href="#" class="">Aliquam congue</a>
              <ul>
                <li><a title="Vestibulum iaculis" href="#">Vestibulum iaculis</a></li>
                <li><a title="Lacinia est" href="#">Lacinia est</a></li>
                <li><a title="Proin dictum" href="#">Proin dictum</a></li>
                <li><a title="Elementum velit" href="#">Elementum velit</a></li>
                <li><a title="Consequat ante" href="#">Consequat ante</a></li>
              </ul>
            </li>
            <li><a title="Pellentesque sed" href="#" class="">Pellentesque sed</a>
              <ul>
                <li><a title="Vestibulum iaculis" href="#">Vestibulum iaculis</a></li>
                <li><a title="Lacinia est" href="#">Lacinia est</a></li>
                <li><a title="Proin dictum" href="#">Proin dictum</a></li>
                <li><a title="Elementum velit" href="#">Elementum velit</a></li>
                <li><a title="Consequat ante" href="#">Consequat ante</a></li>
              </ul>
            </li>
            <li><a title="Enim adipiscing" href="#" class="">Enim adipiscing</a>
              <ul>
                <li><a title="Vestibulum iaculis" href="#">Vestibulum iaculis</a></li>
                <li><a title="Lacinia est" href="#">Lacinia est</a></li>
                <li><a title="Proin dictum" href="#">Proin dictum</a></li>
                <li><a title="Elementum velit" href="#">Elementum velit</a></li>
                <li><a title="Consequat ante" href="#">Consequat ante</a></li>
              </ul>
            </li>
            <li><a title="Aliquet sit amet" href="#" class="">Aliquet sit amet</a>
              <ul>
                <li><a title="Vestibulum iaculis" href="#">Vestibulum iaculis</a></li>
                <li><a title="Lacinia est" href="#">Lacinia est</a></li>
                <li><a title="Proin dictum" href="#">Proin dictum</a></li>
                <li><a title="Elementum velit" href="#">Elementum velit</a></li>
                <li><a title="Consequat ante" href="#">Consequat ante</a></li>
              </ul>
            </li>
            <li><a title="Elliptical Trainers" href="#" class="">Elliptical Trainers</a>
              <ul>
                <li><a title="Vestibulum iaculis" href="#">Vestibulum iaculis</a></li>
                <li><a title="Lacinia est" href="#">Lacinia est</a></li>
                <li><a title="Proin dictum" href="#">Proin dictum</a></li>
                <li><a title="Elementum velit" href="#">Elementum velit</a></li>
                <li><a title="Consequat ante" href="#">Consequat ante</a></li>
              </ul>
            </li>
            <li id="category-thumbnail"></li>
          </ul>
        </li>
        <li class="single-dropdown"><a title="DIET &amp; NUTRITION" href="#">DIET &amp; NUTRITION</a><ul class="submenu-container clearfix first-in-line-xs menu-mobile">
            <li><a title="Aliquam congue" href="#" class="">Aliquam congue</a>
              <ul>
                <li><a title="Vestibulum iaculis" href="#">Vestibulum iaculis</a></li>
                <li><a title="Lacinia est" href="#">Lacinia est</a></li>
                <li><a title="Proin dictum" href="#">Proin dictum</a></li>
                <li><a title="Elementum velit" href="#">Elementum velit</a></li>
                <li><a title="Consequat ante" href="#">Consequat ante</a></li>
              </ul>
            </li>
            <li id="category-thumbnail"></li>
          </ul></li>
        <li><a title="HOUSEHOLD ITEMS" href="#">HOUSEHOLD ITEMS</a></li>
        <li><a title="NATURAL PRODUCTS" href="#">NATURAL PRODUCTS</a></li>
        <li><a title="SEXUAL HEALTH" href="#">SEXUAL HEALTH</a></li>
      </ul>
    </div>
  </div>
</div>
              
            
!

CSS

              
                
*, *:before, *:after { box-sizing: border-box; }

#index #block_top_menu { margin-bottom: -68px; }
 @media (max-width: 767px) {
 #index #block_top_menu {
 margin-bottom: 30px;
}
}

#block_top_menu { padding-top: 32px; margin-bottom: 0px; position: relative; z-index: 2; }

/*** ESSENTIAL STYLES ***/
.sf-contener { clear: both; float: left; width: 100%; }

.sf-menu, .sf-menu * { margin: 0; padding: 0; list-style: none; }

.sf-menu { position: relative; padding: 0; width: 100%; border-top: 8px solid #8dbf41; background: #31353d; display: table; }

.sf-menu ul { position: absolute; top: -999em; background: white; }

.sf-menu ul li { width: 100%; }

.sf-menu li:hover { visibility: inherit;/* fixes IE7 'sticky bug' */ }

.sf-menu > li { float: left; border-right: 1px solid #44474e; width: 20%; }

/*** SINGLE DROPDOWN  START ***/

.sf-menu .single-dropdown { float: left; border-right: 1px solid #44474e; width: 20%; position: relative; }

.sf-menu .single-dropdown ul { padding: 26px 30px 31px; width: 240px; }

.sf-menu > .single-dropdown > ul > li { float: left; width: 100%; padding-right: 15px; }

.sf-menu > .single-dropdown > ul > li > ul { width: 100%; padding: 26px 0 0; }

/*** SINGLE DROPDOWN  END ***/

.sf-menu > li > a { font: 500 12px/17px "Ubuntu", "sans-serif"; text-align: center; text-transform: uppercase; color: #ffffff; display: block; padding: 25px 0px 26px 0px; }

.sf-menu > li.sfHover > a, .sf-menu > li > a:hover, .sf-menu > li.sfHoverForce > a { background: #44474e; color: white; }

.sf-menu li li li a { display: inline-block; position: relative; color: #777777; font: 500 12px/17px "Ubuntu", "sans-serif"; padding-bottom: 10px; }

.sf-menu li li li a:before { content: "\f105"; display: inline-block; font-family: "FontAwesome"; padding-right: 10px; }

.sf-menu li li li a:hover { color: #333333; }

.sf-menu li ul { display: none; left: 0; top: 68px; /* match top ul list item height */ z-index: 99; padding: 12px 0 18px 0; -moz-box-shadow: rgba(0, 0, 0, 0.2) 0 5px 13px; -webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 5px 13px; box-shadow: rgba(0, 0, 0, 0.2) 0 5px 13px; }

.sf-menu li li ul { position: static; display: block !important; opacity: 1 !important; background: none; padding-bottom: 0; -moz-box-shadow: transparent 0 0 0; -webkit-box-shadow: transparent 0 0 0; box-shadow: transparent 0 0 0; }

.sf-menu li li li ul { padding: 0 0 0 20px; }

.sf-menu li li li ul { width: 220px; }

ul.sf-menu li:hover li ul, ul.sf-menu li.sfHover li ul { top: -999em; }

ul.sf-menu li li:hover ul, ul.sf-menu li li.sfHover ul { left: 200px; /* match ul width */ top: 0; }

ul.sf-menu li li:hover li ul, ul.sf-menu li li.sfHover li ul { top: -999em; }

ul.sf-menu li li li:hover ul, ul.sf-menu li li li.sfHover ul { left: 200px; /* match ul width */ top: 0; }

.sf-menu > li > ul { padding: 26px 30px 31px; width: 100%; }

.sf-menu > li > ul > li > a { text-transform: uppercase; font: 500 13px/19px "Ubuntu", "sans-serif"; color: #333333; }

.sf-menu > li > ul > li > a:hover { color: #515151; }

.sf-menu > li > ul > li { float: left; width: 20%; padding-right: 15px; }

.sf-menu > li > ul > li#category-thumbnail { width: 100% !important; float: none; clear: both; overflow: hidden; padding-right: 0; }

.sf-menu > li > ul > li#category-thumbnail > div { float: left; padding-left: 10px; width: 33.333%; }

.sf-menu > li > ul > li#category-thumbnail > div:first-child { padding-left: 0; }

.sf-menu > li > ul > li#category-thumbnail > div img { max-width: 100%; display: block; }

.cat-title { display: none; }

.sf-menu li.sf-search { border: none; }

.sf-menu li.sf-search input { display: inline; padding: 0 13px; height: 30px; line-height: 30px; background: white; margin: 13px 10px 0 0; font-size: 13px; color: #9c9b9b; border: 1px solid #d6d4d4; }
 @media (max-width: 992px) {
 .sf-menu > li > ul > li > a {
 font-size: 11px;
}
}
 @media (max-width: 767px) {
 .sf-menu {
 display: none;
}
 .sf-menu ul {
 position: relative;
}
 .sf-menu > li {
 float: none;
 position: relative;
 border-right: none;
 width: 100%;
}
 .sf-menu > li span {
 position: absolute;
 right: 6px;
 top: 16px;
 width: 30px;
 height: 30px;
 color: #ffffff;
 z-index: 2;
}
 .sf-menu > li span:after {
 font-family: "FontAwesome";
 content: "\f067";
 font-size: 26px;
}
 .sf-menu > li span.active:after {
 content: "\f068";
}
 .sf-menu > li > a {
 text-align: left;
 padding: 15px 20px 16px 20px;
}
 .sf-menu li ul {
 top: 0;
}
 .sf-menu li li ul {
 padding-bottom: 20px;
}
 .sf-menu > li > ul > li {
 width: 50%;
}
 .sf-menu > li > ul > li.first-in-line-lg {
 clear: left;
}


/*** SINGLE DROPDOWN  START ***/

.sf-menu .single-dropdown { float: none; border-right: none; width: 100%; position: relative; }

.sf-menu .single-dropdown ul { padding: 26px 30px 31px; width: 100%; }

.sf-menu > .single-dropdown > ul > li { float: left; width: 100%; padding-right: 15px; }

.sf-menu > .single-dropdown > ul > li > ul { width: 100%; padding: 26px 0 0; }

/*** SINGLE DROPDOWN  END ***/



 .cat-title {
 display: block;
 font: 600 18px/22px "Open Sans", sans-serif;
 text-transform: uppercase;
 color: #ffffff;
 display: block;
 padding: 17px 20px;
 background: #31353d;
 position: relative;
}
 .cat-title:hover {
 background: #31353d;
 border-bottom-color: #666666;
 color: white;
}
 .cat-title:after {
 display: block;
 font-family: "FontAwesome";
 content: "\f067";
 position: absolute;
 right: 15px;
 top: 18px;
 font-size: 26px;
}
 .cat-title.active:after {
 content: "\f068";
}
}
 @media (min-width: 480px) and (max-width: 767px) {
 .sf-menu > li > ul > li.first-in-line-xs {
 clear: left;
}
}
 @media (max-width: 479px) {
 .sf-menu > li > ul > li {
 width: 100%;
}
 .sf-menu > li > ul > li#category-thumbnail > div {
 width: 100%;
 padding-left: 0;
 padding-top: 10px;
 text-align: center;
}

}

              
            
!

JS

              
                var responsiveflagMenu = false;
var categoryMenu = $('ul.sf-menu');
var mCategoryGrover = $('.sf-contener .cat-title');

$(document).ready(function(){
	responsiveMenu();
	$(window).resize(responsiveMenu);
});

// check resolution
function responsiveMenu()
{
   if ($(document).width() <= 767 && responsiveflagMenu == false)
	{
		menuChange('enable');
		responsiveflagMenu = true;
	}
	else if ($(document).width() >= 768)
	{
		menuChange('disable');
		responsiveflagMenu = false;
	}
}

// init Super Fish Menu for 767px+ resolution
function desktopInit()
{
	mCategoryGrover.off();
	mCategoryGrover.removeClass('active');
	$('.sf-menu > li > ul').removeClass('menu-mobile').parent().find('.menu-mobile-grover').remove();
	$('.sf-menu').removeAttr('style');
	categoryMenu.superfish('init');
	//add class for width define
	$('.sf-menu > li > ul').addClass('submenu-container clearfix'); 
	 // loop through each sublist under each top list item
    $('.sf-menu > li > ul').each(function(){
        i = 0;
        //add classes for clearing
        $(this).each(function(){ 
                if ($(this).attr('id') != "category-thumbnail") 
                {
                    i++;
                    if(i % 2 == 1)
                        $(this).addClass('first-in-line-xs');
                    else if (i % 5 == 1)
                        $(this).addClass('first-in-line-lg');
                }
        });
    });
}

function mobileInit()
{
	categoryMenu.superfish('destroy');
	$('.sf-menu').removeAttr('style');

	mCategoryGrover.on('click', function(){
		$(this).toggleClass('active').parent().find('ul.menu-content').stop().slideToggle('medium');
	});

	$('.sf-menu > li > ul').addClass('menu-mobile clearfix').parent().prepend('<span class="menu-mobile-grover"></span>');

	$(".sf-menu .menu-mobile-grover").on('click touchstart', function(){
		var catSubUl = $(this).next().next('.menu-mobile');
		if (catSubUl.is(':hidden'))
		{
			catSubUl.slideDown();
			$(this).addClass('active');
		}
		else
		{
			catSubUl.slideUp();
			$(this).removeClass('active');
		}
		return false;
	});

	if ('ontouchstart' in document.documentElement)
	{
		$('#block_top_menu > ul:first > li > a').on('click', function(e){
			if ($(this).parent('li').find('ul').length)
				e.preventDefault();
		});
	}
}

// change the menu display at different resolutions
function menuChange(status)
{
	status == 'enable'? mobileInit(): desktopInit();
}




/*
 * jQuery Superfish Menu Plugin - v1.7.4
 * Copyright (c) 2013 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 *	https://www.opensource.org/licenses/mit-license.php
 *	http://www.gnu.org/licenses/gpl.html
 */

;(function ($) {
	"use strict";

	var methods = (function () {
		// private properties and methods go here
		var c = {
				bcClass: 'sf-breadcrumb',
				menuClass: 'sf-js-enabled',
				anchorClass: 'sf-with-ul',
				menuArrowClass: 'sf-arrows'
			},
			ios = (function () {
				var ios = /iPhone|iPad|iPod/i.test(navigator.userAgent);
				if (ios) {
					// iOS clicks only bubble as far as body children
					$(window).load(function () {
						$('body').children().on('click', $.noop);
					});
				}
				return ios;
			})(),
			wp7 = (function () {
				var style = document.documentElement.style;
				return ('behavior' in style && 'fill' in style && /iemobile/i.test(navigator.userAgent));
			})(),
			toggleMenuClasses = function ($menu, o) {
				var classes = c.menuClass;
				if (o.cssArrows) {
					classes += ' ' + c.menuArrowClass;
				}
				$menu.toggleClass(classes);
			},
			setPathToCurrent = function ($menu, o) {
				return $menu.find('li.' + o.pathClass).slice(0, o.pathLevels)
					.addClass(o.hoverClass + ' ' + c.bcClass)
						.filter(function () {
							return ($(this).children(o.popUpSelector).hide().show().length);
						}).removeClass(o.pathClass);
			},
			toggleAnchorClass = function ($li) {
				$li.children('a').toggleClass(c.anchorClass);
			},
			toggleTouchAction = function ($menu) {
				var touchAction = $menu.css('ms-touch-action');
				touchAction = (touchAction === 'pan-y') ? 'auto' : 'pan-y';
				$menu.css('ms-touch-action', touchAction);
			},
			applyHandlers = function ($menu, o) {
				var targets = 'li:has(' + o.popUpSelector + ')';
				if ($.fn.hoverIntent && !o.disableHI) {
					$menu.hoverIntent(over, out, targets);
				}
				else {
					$menu
						.on('mouseenter.superfish', targets, over)
						.on('mouseleave.superfish', targets, out);
				}
				var touchevent = 'MSPointerDown.superfish';
				if (!ios) {
					touchevent += ' touchend.superfish';
				}
				if (wp7) {
					touchevent += ' mousedown.superfish';
				}
				$menu
					.on('focusin.superfish', 'li', over)
					.on('focusout.superfish', 'li', out)
					.on(touchevent, 'a', o, touchHandler);
			},
			touchHandler = function (e) {
				var $this = $(this),
					$ul = $this.siblings(e.data.popUpSelector);

				if ($ul.length > 0 && $ul.is(':hidden')) {
					$this.one('click.superfish', false);
					if (e.type === 'MSPointerDown') {
						$this.trigger('focus');
					} else {
						$.proxy(over, $this.parent('li'))();
					}
				}
			},
			over = function () {
				var $this = $(this),
					o = getOptions($this);
				clearTimeout(o.sfTimer);
				$this.siblings().superfish('hide').end().superfish('show');
			},
			out = function () {
				var $this = $(this),
					o = getOptions($this);
				if (ios) {
					$.proxy(close, $this, o)();
				}
				else {
					clearTimeout(o.sfTimer);
					o.sfTimer = setTimeout($.proxy(close, $this, o), o.delay);
				}
			},
			close = function (o) {
				o.retainPath = ($.inArray(this[0], o.$path) > -1);
				this.superfish('hide');

				if (!this.parents('.' + o.hoverClass).length) {
					o.onIdle.call(getMenu(this));
					if (o.$path.length) {
						$.proxy(over, o.$path)();
					}
				}
			},
			getMenu = function ($el) {
				return $el.closest('.' + c.menuClass);
			},
			getOptions = function ($el) {
				return getMenu($el).data('sf-options');
			};

		return {
			// public methods
			hide: function (instant) {
				if (this.length) {
					var $this = this,
						o = getOptions($this);
					if (!o) {
						return this;
					}
					var not = (o.retainPath === true) ? o.$path : '',
						$ul = $this.find('li.' + o.hoverClass).add(this).not(not).removeClass(o.hoverClass).children(o.popUpSelector),
						speed = o.speedOut;

					if (instant) {
						$ul.show();
						speed = 0;
					}
					o.retainPath = false;
					o.onBeforeHide.call($ul);
					$ul.stop(true, true).animate(o.animationOut, speed, function () {
						var $this = $(this);
						o.onHide.call($this);
					});
				}
				return this;
			},
			show: function () {
				var o = getOptions(this);
				if (!o) {
					return this;
				}
				var $this = this.addClass(o.hoverClass),
					$ul = $this.children(o.popUpSelector);

				o.onBeforeShow.call($ul);
				$ul.stop(true, true).animate(o.animation, o.speed, function () {
					o.onShow.call($ul);
				});
				return this;
			},
			destroy: function () {
				return this.each(function () {
					var $this = $(this),
						o = $this.data('sf-options'),
						$hasPopUp;
					if (!o) {
						return false;
					}
					$hasPopUp = $this.find(o.popUpSelector).parent('li');
					clearTimeout(o.sfTimer);
					toggleMenuClasses($this, o);
					toggleAnchorClass($hasPopUp);
					toggleTouchAction($this);
					// remove event handlers
					$this.off('.superfish').off('.hoverIntent');
					// clear animation's inline display style
					$hasPopUp.children(o.popUpSelector).attr('style', function (i, style) {
						return style.replace(/display[^;]+;?/g, '');
					});
					// reset 'current' path classes
					o.$path.removeClass(o.hoverClass + ' ' + c.bcClass).addClass(o.pathClass);
					$this.find('.' + o.hoverClass).removeClass(o.hoverClass);
					o.onDestroy.call($this);
					$this.removeData('sf-options');
				});
			},
			init: function (op) {
				return this.each(function () {
					var $this = $(this);
					if ($this.data('sf-options')) {
						return false;
					}
					var o = $.extend({}, $.fn.superfish.defaults, op),
						$hasPopUp = $this.find(o.popUpSelector).parent('li');
					o.$path = setPathToCurrent($this, o);

					$this.data('sf-options', o);

					toggleMenuClasses($this, o);
					toggleAnchorClass($hasPopUp);
					toggleTouchAction($this);
					applyHandlers($this, o);

					$hasPopUp.not('.' + c.bcClass).superfish('hide', true);

					o.onInit.call(this);
				});
			}
		};
	})();

	$.fn.superfish = function (method, args) {
		if (methods[method]) {
			return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
		}
		else if (typeof method === 'object' || ! method) {
			return methods.init.apply(this, arguments);
		}
		else {
			return $.error('Method ' +  method + ' does not exist on jQuery.fn.superfish');
		}
	};

	$.fn.superfish.defaults = {
		popUpSelector: 'ul,.sf-mega', // within menu context
		hoverClass: 'sfHover',
		pathClass: 'overrideThisToUse',
		pathLevels: 1,
		delay: 800,
		animation: {opacity: 'show'},
		animationOut: {opacity: 'hide'},
		speed: 'normal',
		speedOut: 'fast',
		cssArrows: true,
		disableHI: false,
		onInit: $.noop,
		onBeforeShow: $.noop,
		onShow: $.noop,
		onBeforeHide: $.noop,
		onHide: $.noop,
		onIdle: $.noop,
		onDestroy: $.noop
	};

	// soon to be deprecated
	$.fn.extend({
		hideSuperfishUl: methods.hide,
		showSuperfishUl: methods.show
	});

})(jQuery);

              
            
!
999px

Console