Created
July 30, 2013 02:08
-
-
Save billibala/6109619 to your computer and use it in GitHub Desktop.
Fake a Mac OS X focus ring for DOM element in a web view
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
<html> | |
<head> | |
<title>Focus ring</title> | |
<meta name="author" content="Headnix"> | |
<style type="text/css" media="screen"> | |
.thumbnail { | |
width: 100px; | |
height: 100px; | |
background-color: #eee; | |
} | |
.highlighted { | |
outline: 2px auto -webkit-focus-ring-color; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="thumbnail" onclick="highlightItem(this)"> | |
</div> | |
<script> | |
function highlightItem(anElem) { | |
if ( anElem.classList.length > 1 ) { | |
anElem.classList.remove("highlighted"); | |
} else { | |
anElem.classList.add("highlighted"); | |
} | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment