Skip to content

Instantly share code, notes, and snippets.

@tjp
Created August 10, 2009 11:49
Show Gist options
  • Save tjp/165152 to your computer and use it in GitHub Desktop.
Save tjp/165152 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>kit</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?3.0.0b1/build/cssreset/reset-min.css&amp;3.0.0b1/build/cssfonts/fonts-min.css" />
<style type="text/css">
.kit-module {
width:400px;
border: 2px solid #cccccc;
margin: 2em;
}
.kit-focus {
background: magenta;
}
</style>
</head>
<body>
<div class="kit-modules" id="m1">
<div class="kit-module">
<p style="border:2px solid red; width:50%;">test test test</p>
</div>
<div class="kit-module">
test 2
</div>
<div class="kit-module">
asdf
</div>
</div>
<hr />
<div class="kit-modules" id="m2">
<div class="kit-module">
asdf
</div>
<div class="kit-module">
asdf
</div>
</div>
<script src="http://yui.yahooapis.com/3.0.0b1/build/yui/yui-min.js" type="text/javascript"></script>
<!--script type="text/javascript" src="js/yui3/build/yui/yui-min.js"></script-->
<script type="text/javascript">
YUI().use("node-focusmanager", function(Y) {
var params = {
descendants: ".kit-module",
keys: { next: "down:39", // Right arrow
previous: "down:37" }, // Left arrow
focusClass: "kit-focus"
}
//m1 will break, m2 will work
Y.Node.all(".kit-modules").plug(Y.Plugin.NodeFocusManager, params);
//both will work
//Y.Node.get("#m1").plug(Y.Plugin.NodeFocusManager, params)
//Y.Node.get("#m2").plug(Y.Plugin.NodeFocusManager, params);
//m1 will break, m2 will work
//Y.Node.all("#m1").plug(Y.Plugin.NodeFocusManager, params)
//Y.Node.all("#m2").plug(Y.Plugin.NodeFocusManager, params);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment