views:

54

answers:

1

I'm trying to make a just a simple launch bar with a search button that appears in a page when a hotkey is pressed. I'd prefer not having to use a bunch of libraries like mootools or FancyBox(although I'm sure it would make it easier) since this is for a Chrome Extension and I'd like to keep it as small as possible. Any suggestions or should I just go with one of those tools?

+1  A: 

In javascript you can set up an event listener (onKeyPress) to capture a specific hotkey. The function triggered by the onKeyPress event listener should check the keypress matches the hotkey. If it does, call the function that makes visible or renders your floating bar.

See here for more info from the excellent quirksmode

Richard
Very good site there. Thx. Any ideas for a popup box though, I'm kinda stumped?
Guibone
depends what you mean by a pop up exactly. Generally, your popup is likely to be a block element which is invisible (and absolutely positioned so as not to disturb visible content). On trigger, you change the css in javascript to make it visible. You can add event listeners to make it draggable if required, and style it with shadow so it appears to float above the page.
Richard
Yea, that's pretty much I want. I'll look into that
Guibone