0

This is my js code. Actually I want to set time to apply this css. I tried using setTimeout but not working. How to do using setTimeout or anything else. Please help. Thank you

$(document).ready(function() {
  $(".front").click(function() {
    $(".flip-container").css({
      "height": "0px"
    });
  });
});
2
  • show how did you apply setTimeout Commented Jun 5, 2016 at 10:37
  • yes.. i added setTimeout(function() before $("flip-container") Commented Jun 5, 2016 at 10:41

1 Answer 1

2

Use setTimeout() as follows

$(document).ready(function() {
  $(".front").click(function() {
    setTimeout(function() {
      $(".flip-container").css({
        "height": "0px"
      });
    }, 1000);
  });
});

you can also do it with some animation using animate() method

$(document).ready(function() {
  $(".front").click(function() {
    $(".flip-container").animate({
      "height": "0px"
    }, 1000);
  });
});
Sign up to request clarification or add additional context in comments.

4 Comments

You created demo while you haven't any element!
@Mohammad : just removed :)
..nice..i used .animate instead of .css , it's giving nice animation. Thank you..
@sagarkodte : glad to help you :)

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.