ScrollMagic - FadeIn FadeOut

Developer
Size
2,731 Kb
Views
80,960

How do I make an scrollmagic - fadein fadeout?

What is a scrollmagic - fadein fadeout? How do you make a scrollmagic - fadein fadeout? This script and codes were developed by Kazu on 28 October 2022, Friday.

ScrollMagic - FadeIn FadeOut Previews

ScrollMagic - FadeIn FadeOut - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>ScrollMagic - FadeIn FadeOut</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <header role="banner"> <img src="//s3-us-west-2.amazonaws.com/s.cdpn.io/392/demo_tophat.png" width="64" height="auto" alt="scroll magic" />
</header>
<main class="full-screen" role="main"> <section class="full-screen blue"> <div> <h1>Fade In Fade Out</h1> </div> </section> <section id="fadein-trigger" class="red"> <div> <h1>Fadein Trigger</h1> <p>This text will fade in and fade out as you scroll...yo!</p> </div> </section> <section class="full-screen blue" id="fadeout-trigger"> <div> <h1>Fadeout Trigger</h1> </div> </section>
</main> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/gsap/1.16.1/TweenMax.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.1/ScrollMagic.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.1/plugins/animation.gsap.js'></script> <script src="js/index.js"></script>
</body>
</html>

ScrollMagic - FadeIn FadeOut - Script Codes CSS Codes

/* Demo Styes: Not Required
*/
html,
body { margin: 0; height: 100%;
}
h1,
p { margin: 0; padding: 0;
}
header { position: fixed; top: 10px; left: 10px;
}
section,
section > div { display: flex; justify-content: center; align-items: center; text-align: center; color: #efefef;
}
.full-screen { height: 100%; /*makes panels the entire window height*/
}
.blue { background-color: #3883d8;
}
.red { background-color: #cf3535;
}
#fadein-trigger > div { height: 400px; opacity: 0;
}

ScrollMagic - FadeIn FadeOut - Script Codes JS Codes

var fadein_tween = TweenMax.to('#fadein-trigger > div', .375, { opacity: 1});
var fadeout_tween = TweenMax.to('#fadein-trigger > div', .375, { opacity: 0 });
var controller = new ScrollMagic.Controller();
var fadein_scene = new ScrollMagic.Scene({ triggerElement: '#fadein-trigger', reverse: true
})
.setTween(fadein_tween)
.addTo(controller);
var fadeout_scene = new ScrollMagic.Scene({ triggerElement: '#fadeout-trigger', reverse: true
})
.setTween(fadeout_tween)
.addTo(controller);
ScrollMagic - FadeIn FadeOut - Script Codes
ScrollMagic - FadeIn FadeOut - Script Codes
Home Page Home
Developer Kazu
Username carmerano
Uploaded October 28, 2022
Rating 3
Size 2,731 Kb
Views 80,960
Do you need developer help for ScrollMagic - FadeIn FadeOut?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Kazu (carmerano) Script Codes
Create amazing web content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!