(function($) { $(document).bind('keydown keyup', function(e) { // capture all key up/down events if (e.keyCode === 91 || e.keyCode === 224) { // 91 is command key if (e.type === 'keydown') // don't know why Firefox thinks it's 224 $('body').addClass('cmdDown'); // and I'm too lazy to Google right now else $('body').removeClass('cmdDown'); } }); })(jQuery);
<div id="wrapper"> <h1>Magic cursor refresh</h1> <h2>(not really magical)</h2> <ol> <li>Click here to focus the page</li> <li>Hold your mouse still</li> <li>Hold down ⌘</li> </ol> <p>Hold your mouse still and press and release the Command key to see the cursor change in place. No, it's not a big deal. That's why this page is so short.</p> <p>If you're not seeing the effect, click on the headline to make sure the page is focused and capturing your keystrokes.</p> <p>Works best in Safari and Chrome. Kinda good in Firefox. IE? Dunno.</p> </div>
/* boring stuff */ body { font-family: "Helvetica Neue", helvetica, arial, sans-serif; cursor: auto } #wrapper { width: 450px; margin: 20px auto; } h1,h2 { text-align: center } h1 { text-transform: uppercase; margin: 10px 0; line-height: 1; } h2 { text-transform: lowercase; margin: 0 0 20px; line-height: 1; color: #aaa } ol { list-style-position: outside; margin-left: -50px; } li { text-align: left; background: #ddd; padding: 10px; font-size: 24px; margin: 10px 0; } p { color: #333; line-height: 1.5; } /* the important stuff */ .cmdDown { cursor: wait }