2
@-webkit-keyframes swag{

   0% {-webkit-transform:translateY(0px);}      

  50% {-webkit-transform:translateY(-400px);}

 100% {-webkit-transform:translateY(0px);}

  }

I want to change the "-400 px" in the 50% key-frame dynamically according to the height of an another div.So can we use javascript to achieve this here ? If so,how ?

7
  • You will have to loop through the stylesheet rules and change the keyframe rules. Commented Jan 9, 2015 at 17:50
  • how can i change the key-frame rule ? should i use .css(); and write the entire animation on it ?? @ chipChocolate.py Commented Jan 9, 2015 at 17:52
  • 1
    Well, its lot more than .css(), I'll write an answer. Commented Jan 9, 2015 at 17:53
  • Can post value of "height of an another div" ? Commented Jan 9, 2015 at 18:08
  • It's no big deal,the value of the div changes dynamically.That's why i wanted the keyframe value to get changed aswell.@ guest271314 Commented Jan 9, 2015 at 18:14

2 Answers 2

1

Better use Less (http://lesscss.org/) or Sass (http://sass-lang.com/),which are CSS dynamic languages.

Sign up to request clarification or add additional context in comments.

Comments

0

I don't think SASS will solve the issue you're having.. (but it's still incredibly handy to use)

Could you explain what you're trying to achieve a little more? (eg positioning, what variables on sizing etc)

1 Comment

This is not an "answer".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.