Michael wrote:
> And I wanted that functionality on my site. So I tried the code (which
> uses prototype) and my jQuery code stops working.
> 
> http://www.aber.ac.uk/designstudio/mike/newnew/newweb/
> 
> The lavalamp at the top right has stopped working and so has the drop
> down on the settings and on the right hand sidebar. my firefox web
> developer toolbar tells me that $(document).ready is not a function,
> so I added jQuery.noConflict(); into my code and changed $ to jQuery.
> Then it says that Error: $(".cats-list") is null. And the lavalamp has
> just stopped working.
> 
> Any help would be appreciated to fix these problems.

You changed your first use of $ to jQuery but on the line after you have 
literally:
  $(".cats-list").superfish(....)

Using jQuery in noConflict mode means you cannot use the $() to 
reference jquery stuff.

You have three options:
1) Change every use of $ to jQuery (annoying)
or
2) Redefine your $ for your own use when you need to:

Basically change your jQuery *back* to $ again and encapsulate the whole 
thing in:

(function($){

// Your normal jQuery code using $() here.

})(jQuery);

This creates an inline function with the argument $ passed in. When you 
call the function you pass in jQuery and thus inside that function, 
$==jQuery.

This is generally recommended and is listed here:
http://docs.jquery.com/Plugins/Authoring#Custom_Alias_in_plugin_code

or
3) The thing you are using prototype for (changing the style) would be 
pretty trivial to impelement in jQuery.


I'd suggest you do both 2 and 3 :)

Col

Reply via email to