Quickstart
You've come here to download and integrate ProtoFish. Let's achieve that goal first - you can always read more about ProtoFish when you're finished implementing!
Features
- Lightweight: 5.2kB.
- Unobtrusive: fallback to a standard CSS hover menu.
- Cross-browser: IE6+, Safari 3+, Opera 9+, Chrome, Firefox 2+.
- Fully customizable.
- Accessible for keyboard navigating users (ARIA support can be turned on).
- Multiple instances per page are possible.
- Unlimited sublevels.
- Fast!
- License: MIT.
Specifications
- Requires Prototype 1.6.
- Last modification on 13/07/2009.
Implement it!
-
Download the latest version of ProtoFish and include it in your page.
< script type="text/javascript" src="js/prototype.js">< /script>
< script type="text/javascript" src="js/protofish.js">< /script>
-
Initialize your ProtoFish menu with the following code:
< script type='text/javascript'>
document.observe('dom:loaded', function(){
new ProtoFish('menu-1', '200', 'hover', false, true, true);
});
< /script>
The ProtoFish Class takes six parameters:
- Menu ID (string)
- Delay (string)
- Hovering classname (string)
- Removal of .active classnames on hovering (boolean)
- Whether or not the menu should enable ARIA roles and states (boolean)
- Whether or not the menu should use a shortkey (ctrl+alt+m) to access the menu (boolean)
-
Edit your CSS to support show & hide behavior based on the hover class you defined.
That's it, you're ready to go! If you need help, feel free to contact me on Twitter (@pesla) or leave a comment below this post.
Why ProtoFish?
Most people know the parent of all hover menu's: the SuckerFish dropdown menu published by A List Apart in 2003. Obviously, the name ProtoFish is a combination of the Prototype JS framework and the SuckerFish technique published by A List Apart. There are many enhanced versions of the SuckerFish dropdown around on the web, but none of them met the following, to me important, criteria:
- The script should be based on Prototype,
- The script should be lightweight and
- The script should be easy to implement.
Finding a good menu-script based on criteria #1 is already hard enough, so I decided to write my own class and share it with the world!
Can I customize ProtoFish?
Sure! You're allowed to use ProtoFish without any constraints. Rip the code apart or add some features - use it the way you like! If you download the non-minified ProtoFish version, you can easily get a grip on the code, by reading the comments!
You can also contribute to ProtoFish on github: http://github.com/pesla/ProtoFish/.