views:

263

answers:

4

Hi,

I'm trying to get the lavalamp menu working in a theme, but it just doesn't seem to wanna happen!

I've checked and rechecked the paths for the files, etc - but to no avail.

Any ideas would be appreciated! http://missjennifer.net/srini/

Thank you

+2  A: 

As a rule of thumb, your element id's shouldn't start with a number. You've given ids of 1, 2 and 3 - try changing them to menu1, meny2 and menu3 and adjusting the ids in your script.

$("#menu1, #menu2, #menu3").lavaLamp({
Sohnee
It's not a "rule of thumb" -- it's a rule. HTML elements must begin with a letter: http://www.w3.org/TR/html401/types.html#type-name
tvanfosson
+2  A: 

It appears that you are trying to use numeric IDs for your HTML elements. HTML element ids must begin with a letter. Since your HTML is invalid, your selector $("#1, #2, #3") evaluates to null and thus you get a javascript error.

My solution would be to give your tags a class -- like "lavamenu" and then apply a class selector for your plugin:

$('.lavamenu').lavalamp( ... );

Update:

Since you are also using MooTools, you need to use jQuery in noConflict mode. You can do this using:

var $jq = jQuery.noConflict();

then whenever you would have used the $ function for jQuery, simply use $jq. Note that you need to invoke noConflict() after jQuery is loaded but before any conflicting javascript library is loaded. More information on noConflict() can be found on the jQuery site, as well as ideas on how to use jQuery with other libraries.

$jq(function() {
    $jq('.lavamenu').lavalamp( ... );


});
tvanfosson
Thank you tvanfosson,I've changed everything to use .lavamenu (css, script info in header, etc) but still isn't working. Do I need to edit a jquery file as well? There isn't much left to try ...
Jennifer
Looks like you are including MooTools as well and MooTools is redefining the $ function so that it no longer uses jQuery. I'll update with a suggestion on how to get your jQuery code to work.
tvanfosson
Thank you kindly, I appreciate it ~
Jennifer
Tv, I've just emailed you ...
Jennifer
THANK YOU so much ... it's working! Thank you thank you thank you! Lol
Jennifer
+1  A: 

Please change

<script type="text/javascript"> 
        $(function() {
            $("#1, #2, #3").lavaLamp({
                fx: "backout",
                speed: 700,
                click: function(event, menuItem) {
                    return false;
                }
            });
        });
    </script>

to

<script type="text/javascript"> 
        $(function() {
            $("A").lavaLamp({
                fx: "backout",
                speed: 700,
                click: function(event, menuItem) {
                    return false;
                }
            });
        });
    </script>
Mahin
A: 

You might as well change id to class

<script type="text/javascript"> 
    $(function() {
        $(".menuitem").lavaLamp({
            fx: "backout",
            speed: 700,
            click: function(event, menuItem) {
                return false;
            }
        });
    });
</script>
jerjer
Thank you all, I appreciate your help - however ... I'm a little confused now with all the suggestions!I've changed the javascript section as noted above, but it still isn't working ... sorry, very new to this lavalamp menu.I'll have a look at the jquery files to see if I'm missing anything there. Thank yuo again `
Jennifer