Jump to content
Search Community

Fade-in to rollover

isaballoon test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hey guys. Two things I'm trying to accomplish with a navigation bar. First I want it to fade up on page load. Secondly, I'm looking for opacity tweens on rollovers. 


 


First part I have working, as evidenced here - http://grokhaus.com/navTest/navTest01.html


 


Second part I isolated for testing purposes before combining the two, and this functionality is not working for me (code provided by Carl in a separate post yesterday) - http://grokhaus.com/navTest/navTest02.html


 


On combining the two: would something like this work?



<script>

window.onload = function() {
var video = document.getElementById("video");
var faq = document.getElementById("faq");
var about = document.getElementById("about");
var contact = document.getElementById("contact");

TweenMax.fromTo([video,faq,about,contact], 1.5, {autoAlpha:0}, {autoAlpha:.2, delay:1});
TweenMax.fromTo(home, 1.5, {autoAlpha:0}, {autoAlpha:1, delay:1, onComplete: activateRollover});
}

function activateRollover() {

video.onmouseover = function() {
TweenMax.to(video, 0.2, {opacity:1});
}
video.onmouseout = function() {
TweenMax.to(video, 0.2, {opacity:0.2});
}
}

</script>

Any help here is greatly appreciated.

  • Like 1
Link to comment
Share on other sites

in your code that isn't working, you are simply missing a closing bracket }

 

 

 
 

copied from your site:

window.onload = function() {


var video = document.getElementById("video");


TweenMax.set(video, {opacity:0.2});
video.onmouseover = function() {
 TweenMax.to(video, 0.2, {opacity:1});
}
video.onmouseout = function() {
 TweenMax.to(video, 0.2, {opacity:0.2});
}

//add another bracket to close onload function

}

The code you posted above looks pretty good. I'm pretty sure it should work. 

If not, just create a codepen example that isolates whatever issue you experience. Should be very easy for any of us to help trouble shoot.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...