Advertisement
PlotnikovPhilipp

Untitled

Aug 8th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. function becomingBigger() {
  2. if(switchOfAnimation) {
  3. footer.firstElementChild.style.cssText = "-webkit-transform:scale(1.5);\
  4. -moz-transform:scale(1.5);\
  5. -ms-transform:scale(1.5);\
  6. -o-transform:scale(1.5);\
  7. transform:scale(1.5);";
  8. setTimeout(becomingSmaller, 21000);
  9. } else return;
  10. }
  11.  
  12. function becomingSmaller() {
  13. if(switchOfAnimation) {
  14. footer.firstElementChild.style.cssText = "-webkit-transform:scale(1);\
  15. -moz-transform:scale(1);\
  16. -ms-transform:scale(1);\
  17. -o-transform:scale(1);\
  18. transform:scale(1);";
  19. setTimeout(becomingBigger, 21000);
  20. } else return;
  21. }
  22.  
  23. //Анимируем header & main part of article & footer of article
  24. function animation() {
  25. if(!switchOfAnimation && footer.getBoundingClientRect().top / window.innerHeight < 0.6 && footer.getBoundingClientRect().top >= 0) {
  26. switchOfAnimation = true;
  27. becomingBigger();
  28. } else if((switchOfAnimation && footer.getBoundingClientRect().top / window.innerHeight > 0.6) || footer.getBoundingClientRect().top < 0) {
  29. switchOfAnimation = false;
  30. footer.firstElementChild.style.cssText = "-webkit-transform:scale(1);\
  31. -moz-transform:scale(1);\
  32. -ms-transform:scale(1);\
  33. -o-transform:scale(1);\
  34. transform:scale(1);";
  35. }
  36. }
  37.  
  38. window.addEventListener('load', animation, false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement