Jump to content

Recommended Posts

Hey guys, i was wondering if you could help me with a little JQuery problem?

 

I have a list menu with a sub menu and i want to create a condision were when the sub menu changes to a vissible display i want it to fadeIn using Jquery rather than it just apearing.

 

Any ideas?

 

Link to comment
https://forums.phpfreaks.com/topic/251338-jquery-fadein-problem/
Share on other sites

Sorry i forgot to add the code i have been working on. The code is valid but because the display is set to 'non' initially then it doesn’t take effect, so i need a condition that’s going to say if the display = to block (visible) then fadeIn.

 

$(document).ready(function() {
	$('.SubFade').hover(function() {
		var div = $('.subMenu, this');
		div.fadeIn(2500);	
	});

    });

I have tryied to use toggle() here but it works funny if i rollover the first time the menu fades in but if i then rollover it again the views normal then fades out. I really need it to fade out on hover and when the cursor leaves the sub menu i want it to fade out. This one is realy doing my nut in right now!

 

	$(document).ready(function(){
	$('.SubFade').hover(function(){
		$('.subMenuContainer').toggle(2000);
	});
});

hover() accepts two call backs, one for mouseover and one for mouseout. You need to call the toggle function in each:

 

	$(document).ready(function(){
	$('.SubFade').hover(function(){
		$('.subMenuContainer').toggle(2000);
	}, function() {
		$('.subMenuContainer').toggle(2000);
	});
});

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.