Blogger Ever

Lavazi - Lava Lamp Navigation jQuery Plugin

Change your boring navigation menu into a completely cool Lava lamp navigation with this quick jQuery plugin.

A day before I posted on social media about Lavazi, actually it is a pretty cool jQuery plugin that magically transforms your normal navigation to lava lamp navigation. It allows several option to admin and provides easy access to lava lamp.
March 3, 2015Get a better version of Lavazi (v1.1) here
Well, first let me tell you that this plugin is quite small, means never take time to load. The plugin JS is only 2.24KB that makes it weightless. Beside that it performs great with every navigation.


See the Pen MYEYoR by Mohammad Hamza Dhamiya (@hamzadhamiya) on CodePen.

Setup the plugin

To setup the plugin you just have to make sure that the navigation menu is under <ul> tag and the links under it are in <li> tags.
    <li><a href='#'>Home</a></li>
    <li><a href='#'>Blog</a>
<!-- DropDown Menu -->
        <li><a href='#'>Sublink</a></li>
        <li><a href='#'>Sublink</a></li>
        <li><a href='#'>Sublink</a></li>
        <li><a href='#'>Sublink</a></li>
    <li><a href='#'>Contact</a></li>
    <li><a href='#'>About</a></li>
    <li><a href='#'>Profile</a></li>
    <div style='clear:both'></div>
No matter your navigation is normal or dropdown, it will work perfectly with every navigation menu.


To trigger plugin, use DOM ready function so that it works perfectly. The selector would be the <ul> tag of navigation.
$(document).ready(function() {

I found that sometimes the fonts and other resources are loaded a bit late due to which it could effect lava lamp position, but not to worry about that, this plugin will be reset after page load.


Below listed are the options or settings available for this plugin with their default values.

activeClass [default:selected] : This is one of the important option of the plugin. This option selects the position of the lamp for specific link. If you are at contact page then that link on navigation must have some class to distinguish from other links.

The link with active class will have the lamp below it. If none of the link will have the class then lamp will stay below the first class.

background[default:#222]: This option refers to the color of the lamp. It could be a HEX code, RGB or simply a color name for example red.

theme [default:simple]: This option sets the theme of the lava lamp, you have three options for that: simple, rounded, arrow.

transitionTime [default:300]: This is the transition time of the lava lamp movement. 1 unit equals to 1 millisecond. Default is 300 milliseconds means 0.3 seconds.


 To remove the lamp from the navigation, use just a simple CSS for that.
nav .lavazi_lamp{

Final Thoughts

This is my first jQuery plugin and coded with best practices, but still if you find something wrong, email me [email protected] or mention @hamzadhamiya on Twitter.

2013-2016 Copyright Blogger E\ver . Coded, managed and founded by Mohammad Hamza (@hamzadhamiya) . Hosted on Blogger and fonts used are Raleway and Open Sans.