Home
Menu and Navigation
Here
|
Categories
Other Sections
Sweet Ads
Compatibility
|
|
FF2+ IE7+ Opr8+
jQuery Gooey Menu Author:
Description: jQuery Gooey Menu uses the popular "lava lamp" effect to create CSS menus with a moving gooey background effect. Whenever the mouse moves over a menu item, the desired style that indicates the selected menu item follows the mouse to that item, smoothly highlighting the currently active item. Each menu is simply a standard UL list and very easy to customize, including the gooey effect itself. The gooey effect is simply an absolutely positioned LI element dynamically added to the end of the menu. It is styled using just CSS to create the desired gooey menu look. Groovy! Demos: Step 1: This script uses the following external files. Download them below (right click, and select "Save As"):
Step 2: Add the below code to the HEAD section of your page: Step 2: Then, add the below sample markup to your page, which contains the 4 UL menus you see above: Basic menu setupTo set up a Gooey Menu, simply define the manu's markup on
the page, then call the function <ul id="gooeymenu1" class="gelbuttonmenu">
Two ways to set default selected menu itemThere are two ways to select the menu item that gets the gooey
effect by default when the page loads. It also affects which menu item the
effect snaps back to when the mouse rolls out of the menu entirely. The first
method is just to modify the menu's HTML markup, by adding a CSS class of
" <ul id="gooeymenu1" class="gelbuttonmenu"> That's it- the "JavaScript" item will be selected automatically when the menu is initialized. The second method is to define the " <script> This causes the very first menu item to be selected. If both the 1st and 2nd method of selecting a default menu item is detected, the 2nd method will always override the 1st. If neither is used, then no menu item will be selected from the get go. Customizing the look of the gooey effectHere comes the fun (I promise!) part- customizing the gooey effect itself. As mentioned at the very top, the effect is simply created by styling an absolutely positioned LI element that's dynamically added to the end of the menu. Inside the .js file, this markup is stored in the line: effectmarkup: '<li class="active"></li>', Not that you have to concern yourself with that. Customizing the
look of the gooey effect all takes place inside your .css file, by default Target rule for the Gooey Gel Buttons Menu: ul.gelbuttonmenu li.active{ /*style of LI
that gets dynamically added to menu to create background effect*/ As you can see, nothing magical here. " The following show how the "frame" style of the last "Frame" menu example is created: Target rule for the Gooey Frames Menu: ul.framemenu li.active{ /*style of LI that
gets dynamically added to menu to create background effect*/ The frame itself is rendered just with CSS's As you can see, styling and customizing the gooey effect for your menu is actually very straightforward. Just remember you're styling a LI with CSS class "active" that gets added to the end of the menu and is absolutely positioned. Any style you apply to this LI gets shown beneath the menu links as the former LI moves around behind the menu. Bonus- Four gel button color variationsHere's a bonus for folks not so comfortable around a graphics editor- below are 4 sets of the gel button image used in the first menu above, each sliced up into the 3 requisite parts for your convenience: |