Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function becomingBigger() {
- if(switchOfAnimation) {
- footer.firstElementChild.style.cssText = "-webkit-transform:scale(1.5);\
- -moz-transform:scale(1.5);\
- -ms-transform:scale(1.5);\
- -o-transform:scale(1.5);\
- transform:scale(1.5);";
- setTimeout(becomingSmaller, 21000);
- } else return;
- }
- function becomingSmaller() {
- if(switchOfAnimation) {
- footer.firstElementChild.style.cssText = "-webkit-transform:scale(1);\
- -moz-transform:scale(1);\
- -ms-transform:scale(1);\
- -o-transform:scale(1);\
- transform:scale(1);";
- setTimeout(becomingBigger, 21000);
- } else return;
- }
- //Анимируем header & main part of article & footer of article
- function animation() {
- if(!switchOfAnimation && footer.getBoundingClientRect().top / window.innerHeight < 0.6 && footer.getBoundingClientRect().top >= 0) {
- switchOfAnimation = true;
- becomingBigger();
- } else if((switchOfAnimation && footer.getBoundingClientRect().top / window.innerHeight > 0.6) || footer.getBoundingClientRect().top < 0) {
- switchOfAnimation = false;
- footer.firstElementChild.style.cssText = "-webkit-transform:scale(1);\
- -moz-transform:scale(1);\
- -ms-transform:scale(1);\
- -o-transform:scale(1);\
- transform:scale(1);";
- }
- }
- window.addEventListener('load', animation, false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement