본문으로 바로가기
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
if(isScrolledIntoView(main05)){
    $('#section05 .article h2').css({"animation-play-state":"running"})
        if (!main05Status) {
            $('span.count').each(function(index) {
           var eachnum = $(this).text()
           $(this).prop('Counter',0);
           $(this).animate({
              Counter: eachnum
           }, {
                 interation: 1,
              duration: 3000,
              step: function(now) {
                 $(this).text(parseInt(now));
              }
           });
        });
        main05Status = true;
    }    
}
cs

카운트 0부터 목표수치까지 올리는 애니메이션


마우스휠 이벤트 함수 바깥쪽에 

main05Status = false; 선언하고

flag 값을 이용해서 한번만 움직이도록 해야함. flag값을 다른곳에 주어서 다시 화면으로 돌아왔을 때 동작하도록 할 수 있음.



'퍼블리싱 > TIP' 카테고리의 다른 글

모바일전용사이트 분기시키기  (0) 2016.04.21
모바일웹에서의 FOOTER  (0) 2016.04.06
스크롤 이벤트  (0) 2016.03.30
Swiper Interaction  (0) 2016.03.08
swipe  (0) 2016.03.02