Jump to content
Search Community

Shadow Box

jeff4gee 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

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? 

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