Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
  <script>
    $(document).ready(function(){
      function handleSidenav() {
          $(".nav-list").delegate('li', 'mouseover', function(e) {
              console.log('Mouse Over');
              $(this).find("a").addClass('active');
              $(this).find("div.sub-items").toggle();
          }).delegate('li', 'mouseout', function(e) {
              $(this).find('a').removeClass('active');
              $(this).find("div.sub-items").toggle();
          });
      }
      function checkWidth() {
          var windowsize = $(window).width();
          if (windowsize < 767) {
              smallScreenDelegation();
          } else {
              SmallScreenUndelegation();
          }
      }
      checkWidth();
      handleSidenav();
      $(window).resize(checkWidth);
      $('#remove-hover').click(smallScreenDelegation);
      function smallScreenDelegation() {
        console.log('Mouseover Cleared');
        $('.nav-list').undelegate('li', 'mouseover');
          $(".nav-list").delegate('li a:first', 'click', function(event) {
              if ($(this).next().is(':hidden')) {
                  $(this).addClass('active');
                  $(this).next().slideDown('slow');
              } else {
                  $(this).removeClass('active').next().slideUp('slow');
              }               
              event.preventDefault(); 
          });
      }
    });
  </script>
</head>
<body>
  <ul class="nav-list">
    <li><a href="#">Hover Here</a></li>
  </ul>
  <div id="remove-hover">Click to undelegate</div>
  <p>Hey Mariela dasd</p>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers