Advertisement
Guest User

Untitled

a guest
Oct 8th, 2015
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title></title>
  5. <style type="text/css">
  6. .box {
  7. height: 50px;
  8. width: 50px;
  9. outline: 1px solid black;
  10. }
  11. </style>
  12. </head>
  13. <body>
  14.  
  15. <div class="box"></div>
  16.  
  17. <br/>
  18. <br/>
  19. <br/>
  20.  
  21. <div class="button" onclick="dowork()">
  22. CLICK
  23. </div>
  24. </body>
  25. <script src="//cdn.jsdelivr.net/velocity/1.2.3/velocity.min.js"></script>
  26. <script src="//cdn.jsdelivr.net/velocity/1.2.3/velocity.ui.min.js"></script>
  27. <script type="text/javascript">
  28. var box = document.querySelector('.box');
  29. var direction = -1;
  30. function dowork () {
  31.  
  32. if (direction === -1) {
  33. Velocity(box, {
  34. 'translateX': 200
  35. });
  36. } else {
  37. Velocity(box, {
  38. 'translateX': 0
  39. });
  40. }
  41.  
  42.  
  43. direction = direction * -1;
  44. }
  45.  
  46.  
  47. </script>
  48. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement