Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript fade in fade out issue Re: fade in fade out issue

#91889
mattgoucher
Member

It will make your code 100 times easier to debug if everything is spaced correctly. Also, your script will run alot faster if you define your jQuery objects and then use then, instead of defining them over and over again.

– Matt


jQuery(document).ready(function(){


// Define Your Variable At The Top, So you can use it later
var tag = jQuery('#tt');


jQuery('.jTscroller a').find('img').mouseenter(

function(){

tag.html(jQuery(this).find('img').data('title'));

jQuery(this).prepend(tag);

// You already defined a var, use it.
tag.fadeIn('slow'); //jQuery('#tt').fadeIn('slow');

}

);

link.bind('mouseleave', function(){

jquery(tag).fadeOut('slow')

});


});

If you need a further example, reference my working version that seems to accomplish your problem. (FIDDLE)