스크롤 값 읽어와서 객체를 움직이는 스크립트 인데요.. 주석좀 부탁드릴께요 ㅠㅠ

스크롤 값 읽어와서 객체를 움직이는 스크립트 인데요.. 주석좀 부탁드릴께요 ㅠㅠ

QA

스크롤 값 읽어와서 객체를 움직이는 스크립트 인데요.. 주석좀 부탁드릴께요 ㅠㅠ

본문


<SCRIPT type=text/javascript> 
 var $window = $(window);
 $('.content1').each(function(index) {
  var $self = $(this);
  var offsetCoords = $self.offset();
  $(window).scroll(function() {
   // If this section is in view
   if (($window.scrollTop() + $window.height()) > offsetCoords.top && ((offsetCoords.top + $self.height()) > $window.scrollTop())) {
    var yPos = -($window.scrollTop() / 8);
    if ($self.attr('id') != 'first') {
     yPos += 126;
    }
    var coords = '50%' + yPos + 'px';
    $self.css('backgroundPosition', coords);
    // Check for other sprites in this section
    $('.sprite1', $self).each(function(index) {
     var $sprite = $(this);
     var yPos = -($window.scrollTop() / $sprite.data('speed')) + $sprite.data('offsety');
     $sprite.css('left', yPos);
    });
   }
  });
 });
});
</SCRIPT> ​

 

 

하나씩 지워가며 보고 있는데 도통 이해가 안가네요^^부탁드립니다^^

 

초보들은 항상 고수님들께 감사하고 있습니다!

저도 무럭무럭커서 나중에 도움될수있도록 노력할께요! 감사합니다^^

 

이 질문에 댓글 쓰기 :

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 125,873
© SIRSOFT
현재 페이지 제일 처음으로