Jump to content
Search Community

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

Posted

I know there are many ways to do a shadow box effect but is there a simple method that incorporates GSJS much like the shadow box effect for downloading GreenSock packages.

 

Thanks for you help.

Posted

Not that make it completely automated (yet), no. But I can tell you what we did here: just create a div that's got styles like this:

 

#dimmer {
    background-color: black;
​    ​opacity:0;
    visibility: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    top:0px;
    left:0px;
    z-index: 100;
    cursor: pointer;
    margin:0;
    padding:0;
}

And then of course your actual content should have a higher z-index than that so that it shows up in front. Add a "click" listener using jQuery like this so that when it is clicked, things animate off/closed/whatever:

 

$("#dimmer").on("click", closeShadowBox);
function closeShadowBox() {
    TweenLite.to("#dimmer", 0.2, {autoAlpha:0});
    //and then add your code to animate your content out - here's a simple fade-out...
    TweenLite.to("#shadowBoxContent", 0.2, {autoAlpha:0});
}

So you can use a simple autoAlpha tween to make the dimmer bg visible.

 

TweenLite.to("#dimmer", 0.2, {autoAlpha:0.6});

And of course animate your content on however you please. 

 

Is that what you were looking for? 

Posted

Thanks for the quick reply. This is exactly what I was looking for. This will help me build it out. I did not realize how easy it was. Thanks again.

Posted

One other question about the GSJS shadow box. How can I have a css3 animation play for the content animating in and then fall back to another tween when browser doesn't support css3. 

 

Thanks.

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...