How does this jquery loop works? -
i ask how loop works ?
i've read docs .data() method can't figure out happening in example. @ begging set 'size' , big parameters this?
if ($(window).width() >= 1025) { $(function(){ $('.navbar').data('size', 'big'); $(window).scroll(function(){ if ($(document).scrolltop() > 0) { if ($('.navbar').data('size') == 'big') { $('.navbar').data('size', 'small'); $('.navbar').stop().animate({ height: '5vh' }, 600); } } else { if ($('.navbar').data('size') == 'small') { $('.navbar').data('size', 'big'); $('.navbar').stop().animate({ height: '15vh' }, 600); } } });
there no loop, data storing parameter "size". (can 'big' or 'small').
the value changing when scrolling. height of navbar updated.
Comments
Post a Comment