Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. $("#leftlogo").on("mouseover", function(t) {
  2. $(t.target).css("animation-name", "left-over");
  3. }).on("mouseout", function(t) {
  4. $(t.target).css("animation-name", "left-out");
  5. });
  6.  
  7. //set boolean when animating
  8. var isAnimating = false;
  9.  
  10. $("#leftlogo").on({
  11. //handle mouseover
  12. "mouseover": function(t) {
  13. $(t.target).css("animation-name", "left-over");
  14. isAnimating = true;
  15. },
  16. //handle animationend event
  17. "animationend": function(e) {
  18. if (e.animationName == "animation-name")
  19. { isAnimating = false; }
  20. },
  21. //handle mouseout
  22. "mouseout": function(t) {
  23. while (isAnimating != false)
  24. {
  25. //hang on a sec
  26. };
  27.  
  28. $(t.target).css("animation-name", "left-out");
  29. });
  30.  
  31. #leftlogo {
  32. transition: all 1s;
  33. background: pink;
  34. }
  35.  
  36. #leftlogo:hover{
  37. background: yellow;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement