Pure Javascript for Image or DIV Flip

一曲冷凌霜 提交于 2019-12-25 03:29:14

问题


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


回答1:


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>



回答2:


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.



来源:https://stackoverflow.com/questions/28492791/pure-javascript-for-image-or-div-flip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!