Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-02-2012, 09:06 PM   PM User | #1
ajh108
New to the CF scene

 
Join Date: Oct 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
ajh108 is an unknown quantity at this point
fadeIn, fadeOut issue

Hi,

I have a hover effect whereby an image is being faded out and another is fading in. However, Is there a way for these actions to happen simultaneously? So as one is fading out the other fades in.

The second image is displayed none on page load.

My code so far is:
Code:
$('.square').mouseenter(function () {
    $(this).attr('data-image', 'two');
    $(this).find('.one').fadeOut('medium');
    $(this).find('.two').fadeIn('medium');
});
Thanks,
ajh108 is offline   Reply With Quote
Old 10-02-2012, 11:35 PM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,455
Thanks: 0
Thanked 498 Times in 490 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
What you are looking for is usually called a cross fade.

I am not sure whether the JavaScript framework you are using one provides that functionality but it is definitely possible to do using JavaScript.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 10-03-2012, 12:59 AM   PM User | #3
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,609
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
Quote:
Originally Posted by ajh108 View Post
However, Is there a way for these actions to happen simultaneously? So as one is fading out the other fades in.
That is exactly what should happen with your code. What’s the problem?
__________________
Don’t click this link!
VIPStephan is online now   Reply With Quote
Reply

Bookmarks

Tags
javascript, jquery

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:23 PM.


Advertisement
Log in to turn off these ads.