Pure Javascript for Image or DIV Flip

2019-09-02 05:39发布

As i need to code html in my software so i need only pure javascript for fliping.

Please no css animation or Jquery animation, only pure javascript.

need similar to : http://pingmin-tech.com/flipcardjs

found one solution here : DEMO

but it will be better if i get similar to http://pingmin-tech.com/flipcardjs

2条回答
何必那么认真
2楼-- · 2019-09-02 06:10

Buddy if you want the same thing as given in the link then you must use the jQuery file and the given css.

What is the problem in using the files?

The link you have provided has full code and demo on performing what you want, just use it.

It is much better as compared to any other alternate way to achieve what you want.

查看更多
Juvenile、少年°
3楼-- · 2019-09-02 06:21

javascript before your html code.

and this link is the answer your asked me below comments: https://jsfiddle.net/ws7054r2/

#card {
  display: block;
  width: 50px;
  height: 50px;
  padding: 25px;
  background-color: black;
  color: white;
  font-family: 'Arial', sans-serif;
}
<script>
  var k = 0;

  function flip() {
    var j = document.getElementById("card");
    k += 180;
    j.style.transform = "rotatey(" + k + "deg)";
    j.style.transitionDuration = "0.5s"
  }
</script>
<div id="card" onmouseover="flip()">sample text</div>

查看更多
登录 后发表回答