Created
October 9, 2013 15:40
-
-
Save NOEinteractive/6903261 to your computer and use it in GitHub Desktop.
Hover accessible et touch friendly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="wrapper"> | |
<div class="foo"> | |
<span class="bar"></span> | |
</div> | |
<div class="foo"> | |
<span class="bar"></span> | |
</div> | |
<div class="foo"> | |
<span class="bar"></span> | |
</div> | |
<div class="foo"> | |
<span class="bar"></span> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(Modernizr.touch) { | |
$('#wrapper').on('click', 'div.foo', function(e) { | |
$(e.currentTarget).toggleClass('hover'); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.no-js .foo:hover .bar, | |
.no-touch .foo:hover .bar, | |
.touch .foo.hover .bar { | |
/*les styles du hover*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment