cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

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.

            
              
<ul>
	<li>
		<a href="#">Alphabet</a>
		<ul>
			<li>
				<a href="#">Aa</a>
			</li>
			<li>
				<a href="#">Bb</a>
			</li>
			<li>
				<a href="#">Cc</a>
			</li>
			<li>
				<a href="#">Dd</a>
			</li>
			<li>
				<a href="#">Ee</a>
			</li>
			<li>
				<a href="#">Ff</a>
			</li>
			<li>
				<a href="#">Gg</a>
			</li>
			<li>
				<a href="#">Hh</a>
			</li>
			<li>
				<a href="#">Ii</a>
			</li>
			<li>
				<a href="#">Jj</a>
			</li>
      <li>
        <a href="#">Kk</a>
      </li>
      <li>
        <a href="#">Ll</a>
      </li>
      <li>
        <a href="#">Mm</a>
      </li>
      <li>
        <a href="#">Nn</a>
      </li>
      <li>
        <a href="#">Oo</a>
      </li>
      <li>
        <a href="#">Pp</a>
      </li>
      <li>
        <a href="#">Qq</a>
      </li>
      <li>
        <a href="#">Rr</a>
      </li>
      <li>
        <a href="#">Ss</a>
      </li>
      <li>
        <a href="#">Tt</a>
      </li>
      <li>
        <a href="#">Uu</a>
      </li>
      <li>
        <a href="#">Vv</a>
      </li>
      <li>
        <a href="#">Ww</a>
      </li>
      <li>
        <a href="#">Xx</a>
      </li>
      <li>
        <a href="#">Yy</a>
      </li>
      <li>
        <a href="#">Zz</a>
      </li>

		</ul>
	</li>
	<li>
		<a href="#">Other Menu Item</a>
	</li>
  <li>
    <a href="#">States and Cities</a>
    <ul>
      <li><a href="#">Alaska</a></li>
      <li><a href="#">Alabama</a></li>
      <li><a href="#">Arkansas</a></li>
      <li><a href="#">Arizona</a></li>
      <li><a href="#">California</a></li>
      <li><a href="#">Colorado</a></li>
      <li><a href="#">Connecticut</a></li>
      <li><a href="#">Delaware</a></li>
      <li><a href="#">Florida</a></li>
      <li><a href="#">Georgia</a></li>
      <li><a href="#">Hawaii</a></li>
      <li><a href="#">Iowa</a></li>
      <li><a href="#">Idaho</a></li>
      <li><a href="#">Illinois</a></li>
      <li><a href="#">Indiana</a></li>
      <li><a href="#">Kansas</a></li>
      <li><a href="#">Kentucky</a></li>
      <li><a href="#">Louisiana</a></li>
      <li><a href="#">Massachusetts</a></li>
      <li><a href="#">Maryland</a></li>
      <li><a href="#">Maine</a></li>
      <li><a href="#">Michigan</a>
        <ul>
          <li><a href="#">Detroit</a></li>
          <li><a href="#">Flint</a></li>
          <li><a href="#">Hell</a></li>
          <li><a href="#">Lansing</a></li>
          <li><a href="#">Grand Rapids</a></li>
        </ul>
      </li>
      <li><a href="#">Minnesota</a></li>
      <li><a href="#">Missouri</a></li>
      <li><a href="#">Mississippi</a></li>
      <li><a href="#">Montana</a></li>
      <li><a href="#">North Carolina</a></li>
      <li><a href="#">North Dakota</a></li>
      <li><a href="#">Nebraska</a></li>
      <li><a href="#">New Hampshire</a></li>
      <li><a href="#">New Jersey</a></li>
      <li><a href="#">New Mexico</a></li>
      <li><a href="#">Nevada</a></li>
      <li><a href="#">New York</a></li>
      <li><a href="#">Ohio</a>
        <ul>
          <li><a href="#">Akron</a></li>
          <li><a href="#">Bainbridge</a></li>
          <li><a href="#">Brooklyn</a></li>
          <li><a href="#">Brooklyn Heights</a></li>
          <li><a href="#">Centerville</a></li>
          <li><a href="#">Cleveland Heights</a></li>
          <li><a href="#">Cuyahoga Heights</a></li>
          <li><a href="#">Fairview Park</a></li>
          <li><a href="#">Garfield Heights</a></li>
          <li><a href="#">Kettering</a></li>
          <li><a href="#">Kirtland</a></li>
          <li><a href="#">Mayfield</a></li>
          <li><a href="#">Mayfield Heights</a></li>
          <li><a href="#">Middleburg Heights</a></li>
          <li><a href="#">Parma</a></li>
          <li><a href="#">Parma Heights</a></li>
          <li><a href="#">Seven Hills</a></li>
          <li><a href="#">Shaker Heights</a></li>
          <li><a href="#">University Heights</a></li>
          <li><a href="#">Upper Arlington</a></li>
          <li><a href="#">Valley View</a></li>
          <li><a href="#">Warrensville Heights</a></li>
          <li><a href="#">Worthington</a></li>
        </ul>
      </li>
      <li><a href="#">Oklahoma</a></li>
      <li><a href="#">Oregon</a></li>
      <li><a href="#">Pennsylvania</a></li>
      <li><a href="#">Rhode Island</a></li>
      <li><a href="#">South Carolina</a></li>
      <li><a href="#">South Dakota</a></li>
      <li><a href="#">Tennessee</a></li>
      <li><a href="#">Texas</a></li>
      <li><a href="#">Utah</a></li>
      <li><a href="#">Virginia</a></li>
      <li><a href="#">Vermont</a></li>
      <li><a href="#">Washington</a></li>
      <li><a href="#">Wisconsin</a></li>
      <li><a href="#">West Virginia</a></li>
      <li><a href="#">Wyoming</a></li>
    </ul>
  </li>
</ul>
            
          
!
            
              body {
  font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  padding: 20px 50px 150px;
  font-size: 13px;
  text-align: center;
  background: #FFF;
}

a {
  text-decoration: none;
  color: #999;
}

ul {
  text-align: left;
  display: inline;
  margin: 0;
  padding: 15px 4px 17px 0;
  list-style: none;
  -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
  -moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}
ul li {
  font: bold 12px/18px sans-serif;
  display: inline-block;
  position: relative;
  padding: 15px 20px;
  background: #fff;
  cursor: pointer;
  -webkit-transition: all 0.2s;
  -moz-transition: all 0.2s;
  -ms-transition: all 0.2s;
  -o-transition: all 0.2s;
  transition: all 0.2s;
}
ul li:hover {
  background: #555;
  color: #fff;
}
ul li.children > a:after {
   content: ' ▾';
}

ul li ul li.children > a:after {
   color: #FFF;
   content: ' ....';
}

ul li ul {
  padding: 10px 0px;
  background: #000;
  position: absolute;
  display: none;
  opacity: 0;
  z-index: 1000;
  visibility: hidden;
  -webkit-transiton: opacity 0.2s;
  -moz-transition: opacity 0.2s;
  -ms-transition: opacity 0.2s;
  -o-transition: opacity 0.2s;
  -transition: opacity 0.2s;
  border: 1px solid #999;
}
ul li ul li { 
  background: #555; 
  display: block; 
  color: #fff;
  text-shadow: 0 -1px 0 #000;
  width: 200px;
  -webkit-transiton: height 0.1s;
  -moz-transition: height 0.1s;
  -ms-transition: height 0.1s;
  -o-transition: height 0.1s;
  -transition: height 0.1s;
}

ul li ul li a{
  margin:0px;
  padding:0px;
}

ul li ul li:hover { background: #666; }
ul li:hover > ul {
  display: block;
  opacity: 1;
  visibility: visible;
}

ul li ul li ul {
  left: 190px;
  top: 0px;
}
            
          
!
            
              $(document).ready(function(){


    //add class to li with children
    $('li ul').each(function(){
      $(this).parent().addClass('children');
    });

    //set maximumn number of children visible at once
    var itmCountMax = 10;

    //y buffer slows things down and gives user more control
    var yClick = 5;
    var yClickTrack = 0;



    //cycle through each menu
    $('ul').each(function() {

        //if submenu height is maxed out assign scroll event
        if ($(this)[0].children.length > itmCountMax){

            //hide everything out-side of initial view
            for (i=0; i<$(this)[0].children.length; i++) {
              if (i < itmCountMax) {
                  $($(this)[0].children[i]).css('display', 'block');
                  $($(this)[0].children[i]).find('a').css('display', 'block');
              } 
              else {
                  $($(this)[0].children[i]).css('display', 'none');
                  $($(this)[0].children[i]).find('a').css('display', 'none');
              }
            }

            
            //mouse over scroll
            $(this).mousemove(function(e) {

                e.stopPropagation();

                //number of children
                var itmCount = $(this)[0].children.length;
                if (isNaN(itmCount)) itmCount = 0;

                //height of single child element
                var itmHeight = Math.round($(this).height() / (itmCount - itmCountMax));

                //calculate mouse y position on ul menu
                var mouseYpos = e.pageY - $(this).offset().top;
                if(mouseYpos < itmHeight) mouseYpos = 0;

                //calculate child focus off of relative scale
                var currentItmPos = Math.round(mouseYpos / itmHeight);

                //if ( (mouseYpos - yClickTrack > yClick) || (yClickTrack - mouseYpos > yClick) ){
                
                  //console.log("ITM:" + currentItmPos + " POS:" + mouseYpos);

                  //cycle through children to hide and show correct ones
                  for (i=0; i<itmCount; i++) {

                      if(i < currentItmPos) {
                          $($(this)[0].children[i]).css('display', 'none');
                          $($(this)[0].children[i]).find('a').css('display', 'none');
                      }
                      else if (i < currentItmPos + itmCountMax) {
                          $($(this)[0].children[i]).css('display', 'block');
                          $($(this)[0].children[i]).find('a').css('display', 'block');
                      } 
                      else {
                          $($(this)[0].children[i]).css('display', 'none');
                          $($(this)[0].children[i]).find('a').css('display', 'none');
                      }
                  }
                //}
                
            });

            //mouse out reset scroll
            $(this).mouseout(function(e) {
                //$(this).scrollTop(0);
            });

        } else {
          $(this).mousemove(function(e) {
            e.stopPropagation();
          });
        } 

    });

});
            
          
!
999px
Loading ..................

Console