0
var containerHeight = $(".item").height();

    $(".word-game .nWord").css({
        "-webkit-transform" : "translate(0, " + containerHeight + ")"
    });

here is my code, but it doesn't work. i'm really tired.

6
  • 2
    I wanted to put in some effort to help you out but I got tired. Commented Dec 30, 2014 at 19:16
  • it still doesn't work :S Commented Dec 30, 2014 at 19:17
  • A Fiddle would be helpful + are you using a browser that supports CSS3? Commented Dec 30, 2014 at 19:18
  • yes, i use chrome latest version. thanks for your comment. Commented Dec 30, 2014 at 19:20
  • 1
    I'll give you a half-answer to your half-question. translate() doesn't take integers as arguments. Commented Dec 30, 2014 at 19:21

3 Answers 3

2

Just add px or % to your current function since translate doesn't know what to do with a plain integer.

var containerHeight = $(".item").height();

$(".word-game .nWord").css({
    "transform" : "translate(0,"+containerHeight+"px)"
});

http://jsfiddle.net/nuuLjhL0/

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

1 Comment

thank you, i try this before your comment but it wasn't work. i try now again and perfect.
1

try this:

$(document).ready(function(){
var containerHeight = $(".item").height();
   $(".word-game .nWord").css({
     "-webkit-transform":"translate(0px,"+containerHeight+"px)"
    });
});

Comments

0

Making sure it works in all browsers :)

            "-webkit-transform": "translate(0,"+containerHeight+"px)",
            "-moz-transform": "translate(0,"+containerHeight+"px)",
            "-ms-transform":"translate(0,"+containerHeight+"px)",
            "-o-transform":"translate(0,"+containerHeight+"px)",
            "transform": "translate(0,"+containerHeight+"px)"

Comments

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.