diff options
author | Kyle K <kylek389@gmail.com> | 2013-06-15 19:52:17 -0500 |
---|---|---|
committer | Kyle Kaminski <kyle@kkaminsk.com> | 2013-06-15 19:52:17 -0500 |
commit | f5f461aaf9f08951fa3990e49b51a076f7036b16 (patch) | |
tree | deaf01c5633ef17b885d00546e7ea085ab1d1652 /jquery-register-event.xhtml | |
download | websandbox-f5f461aaf9f08951fa3990e49b51a076f7036b16.tar.gz websandbox-f5f461aaf9f08951fa3990e49b51a076f7036b16.tar.bz2 websandbox-f5f461aaf9f08951fa3990e49b51a076f7036b16.zip |
initial commit
Diffstat (limited to 'jquery-register-event.xhtml')
-rw-r--r-- | jquery-register-event.xhtml | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/jquery-register-event.xhtml b/jquery-register-event.xhtml new file mode 100644 index 0000000..cd16ae7 --- /dev/null +++ b/jquery-register-event.xhtml @@ -0,0 +1,42 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" +"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>register event</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<style type="text/css"> + .normal { + background-color: gray; + width: 300px; + height: 200px + font-size: 1.5em; + } + .highlighted { + background-color: red; + } +</style> +<script type="text/javascript" src="jquery-2.0.2.js"></script> +<script type="text/javascript"> +<![CDATA[ + <!-- pass in an anonymous function to jquery, ha --> + $(function() { + <!-- http://api.jquery.com/on/ --> + $("#mdiv").on("mouseover mouseleave", highlight) + .on("click", function(event) { + $("#mdiv").off("mouseover mouseleave", highlight); + }); + }); + + function highlight(event) { + $("#mdiv").toggleClass("highlighted"); + } +]]> +</script> +</head> +<body> +<div id="mdiv" class="normal"> +<p>This is some text. Mouseover here to fire an event. Click to suspend that handler.</p> +</div> +</body> +</html> + |