lavaLamp plugin - A way to change manually the selected element.
Hello all,
I haven't seen yet a way to change manually the selected element of a lavaLamp menu, so I have searched a solution and here it is :
- // Function to change the selected element of a lavaLamp menu.
- // You can use both the number of the li (starting with 0) or the li element itself.
- function lavaMove(el) {
- if (!el && el !== 0) return false;
- else if (/^[0-9]+$/.test(el)) el = $($("ul#menu > li").get(el));
- el.trigger('mouseenter');
- el.trigger('click');
- return true;
- }
It's perhaps not the better way to do that, but it works fine for me, so I decided to share it ... Perhaps somebody will found his happiness with it ! ;)
Please feel free to make comments !
Nashii aka XaF