Skip to content

Instantly share code, notes, and snippets.

View petehalverson's full-sized avatar

Pete Halverson petehalverson

View GitHub Profile
@petehalverson
petehalverson / subnav.js
Created May 22, 2013 21:03
JS for touch subnav. Requires: Modernizr (expects the touch class) and hover classes in CSS.
$(function() {
if ($('html').hasClass('touch'))
{
$('html').click(function(e) {
$('nav > ul > li').removeClass('hover');
});
$('nav > ul > li').click(function(e) {
if (!$(this).hasClass('hover') && $(this).has('ul.subnav').length > 0)