Example showing how to switch between an open and closed hand cursor during mouse up and down events.
Modified from http://jsfiddle.net/uZ377/21/ for use with d3.
Example showing how to switch between an open and closed hand cursor during mouse up and down events.
Modified from http://jsfiddle.net/uZ377/21/ for use with d3.
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
} | |
div{ | |
height: 100px; border: solid 1px #ddd; | |
} | |
.open { | |
cursor: url(https://mail.google.com/mail/images/2/openhand.cur), default !important; | |
} | |
.closed { | |
cursor: url(https://mail.google.com/mail/images/2/closedhand.cur), default !important; | |
} | |
</style> | |
<body> | |
<div class="open"> | |
Open Hand | |
</div> | |
<div class="closed"> | |
Closed Hand | |
</div> | |
<div id="click" class="open"> | |
Click Me | |
</div> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | |
<script> | |
d3.select("#click") | |
.on("mousedown", function() { | |
d3.select(this).classed({'open' : false, 'closed' : true}); | |
}) | |
.on("mouseup", function() { | |
d3.select(this).classed({'open' : true, 'closed' : false}); | |
}); | |
</script> |