As a proportion to reduce .animate() a rectangular block?

There is a rubber block
width: 100%;
height: 100%;

Further animaroo it to
$(window).scroll(function(){
 z = 2050;
 var top = $(this).scrollTop();
}
 if (top >= z) {
 $('.study_part_main').animate({'width': '14%', 'height': '55%'}, 700);
}
 });

But he is reduced first by length, then by height, and want to get to at the same time smaller and long and the height of that prompt ? Thank you.
July 9th 19 at 13:30
2 answers
July 9th 19 at 13:32
Hmm, all together moving: https://jsfiddle.net/ez9fetrt/
July 9th 19 at 13:34
I have reduced synchronously on both sides - https://jsfiddle.net/bp2067z2/
UPD. Maybe you need or unbind a function on scroll to or enter the checking that animation started and then again when her best personal Finance don't try to run.
If not difficult, can you elaborate more about the unbind function to scroll, or that the animation started, how to apply it ? - elsie.Stamm33 commented on July 9th 19 at 13:37
$(window).unbind('scroll');
But in your case, probably the code more complicated, and need something like a global variable block_animation_started=0; during startup of animacii to do block_animation_started = 1 and check in addition to top >= z still block_animation_started == 0.
Can be done prettier using addClass (non-existent) and check this class. - Daphne_Roob commented on July 9th 19 at 13:40
: did the same thing remains
spacedeer.com.ua/testanimation - elsie.Stamm33 commented on July 9th 19 at 13:43

Find more questions by tags JavaScript