Guest User

Untitled

a guest
Jul 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. var blocking = false;
  2.  
  3. alert(Animate.whichTransition);
  4.  
  5. document.getElementById('click').onclick = function(e) {
  6. if (blocking) {
  7. return false;
  8. }
  9.  
  10. blocking = true;
  11.  
  12. var that = this,
  13. el = document.getElementById('test'),
  14. from = (this.className == 'animated') ? 1 : 0,
  15. to = from == 1 ? 0 : 1;
  16.  
  17. // relevant stuffs
  18. if (Animate.canTransition) {
  19. switch (Animate.whichTransition) {
  20. case 'webkit':
  21. console.log('WebKit Vendor Prefix');
  22. el.style.WebkitTransition = 'opacity 0.5s ease-out';
  23. break;
  24. case 'mozilla':
  25. console.log('Mozilla Vendor Prefix');
  26. el.style.MozTransition = 'opacity 0.5s ease-out';
  27. break;
  28. case 'opera':
  29. console.log('Opera Vendor Prefix');
  30. el.style.OTransition = 'opacity 0.5s ease-out';
  31. break;
  32. default:
  33. console.log('W3C Standard Compliant Browser');
  34. el.style.transition = 'opacity 0.5s ease-out';
  35. break;
  36. }
  37.  
  38. el.style.opacity = to;
  39. blocking = false;
  40. that.className = (that.className == 'animated') ? '' : 'animated';
  41. } else {
  42. new Animate(el, 'opacity', {
  43. from: from,
  44. to: to,
  45. time: 500,
  46. callback: function() {
  47. that.className = (that.className == 'animated') ? '' : 'animated';
  48. blocking = false;
  49. }
  50. }).start();
  51. }
  52.  
  53. return false;
  54. }};
Add Comment
Please, Sign In to add comment