Hello, You only need to call hover once at page load to set it. Unless you're waiting to provide the hover effect later after some user interaction, wrap the jQuery(element).hover(...) statements in the jQuery's document.ready:
jQuery( function() { jQuery(element).hover(...); jQuery(element2).hover(...); ... } Tutorial: http://www.learningjquery.com/2006/09/introducing-document-ready It would also be useful to see an example page with your code, if one is available. Charles doublerebel.com On Oct 31, 1:46 am, e2e <[EMAIL PROTECTED]> wrote: > Hi, > > I've two simple functions for changing a div's content with image > thumbnails. When hovered a thumbnail holder div's content changes. The > code works fine. But I don't feel this functions are well written... > Could you please have a look at them? Is there a better way (design, > code...) to do what I'm triying? > > jQuery.fn.selectMain = function() { > jQuery("#mains div").hide(); > jQuery("#main1").show(); > jQuery("#thumbnails li").eq(0).addClass("active"); > > return jQuery("#thumbnails li").hover(function(){ > jQuery("#mains div").hide(); > jQuery("#thumbnails li").removeClass("active"); > var main = $(this).find("a").attr("rel"); > $(this).addClass("active"); > jQuery("#" + main).show(); > > }, function() { } > ); > > }; > > jQuery.fn.selectVideo = function() { > jQuery("#vid_thumbnails li").eq(0).addClass("active"); > > return jQuery("#vid_thumbnails li").hover(function(){ > jQuery("#video_news .main_image").empty(); > var new_vid = $(this).html(); > var new_title = $(this).find("img").attr("alt"); > var new_content = new_vid + "<h2>" + new_title + > "</h2>"; > jQuery("#video_news .main_image").append(new_content); > > }, function() { } > ); > > };