0

I want to set the x and y as a start position of the keyframe animation.. I'm a beginner in JavaScript ... hope that this is possible.

JS:

var x = event.screenX;
var y = event.screenY;

$(".container").css({
    right : "x",
    top: "y"
}).addClass("openContainer");

CSS:

.openContainer {
    height: 100vh;
    background-color: black;
    opacity: .8;
    z-index:100;
    animation: play 1s;
    animation-iteration-count: 1;
}    

@keyframes play {
    0% {
        transform: scale(0, 0);
    }
    25% {
        transform: scale(.7, 1.1);
    }
    50% {
        transform: scale(1.1,.9);
    }
    100% {
        transform: scale(1, 1);
    }

}

Thanks in advance

2
  • Finish your question and format it properly, then you might get help Commented Dec 17, 2013 at 7:35
  • Where is CSS part post that part also. Commented Dec 17, 2013 at 7:36

1 Answer 1

1
$(".container").css({
    right : x + "px", // its not "x"
    top: y + "px" // its not "y"
}).addClass("openContainer");
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.