을 중지하는 경우고정 문은 내가 달성하기 위해 노력하고 어떤 운동
사용자가 이미지를 픽셀로 이동할 수 있는지 설정할 수 있도록 레이서 오프셋입니다. offsetted는 얼마나 멀리 상쇄되었는지를 관리합니다. 스피드 레이서는 스크롤하는 동안 이미지가 얼마나 빨리 움직일 수 있는지 알려줍니다. 내 문제는 멈추지 않아. 나는 바이올린을 제공 할 수 있지만 먼저이 파일을 수정하지 않고 쉽게 해결할 수 있는지 알아볼 수 있습니다. 감사.
HTML
<img class="images" racer-offset="250" speed-racer="3" src="http://assets/img/fwman/FeeneyMan_bike.png" loc="576" style="left: 540px;" offsetted="924">
자바 스크립트
$(window).scroll(function(){
$('.images').each(function(){
if($('this').attr('racer-offset') < $(this).attr('offsetted')){
}
else {
var speedR = $(this).attr('speed-racer');
$('.images').css({left : "-="+speedR});
$('.images').attr('offsetted', $(this).position().left);
}
});
});
$('.images').each(function(){
$(this).attr('loc', $(this).position().left);
});
유일한 것은 해결하기 위해 왼쪽 내가 오프셋 레이서에 추가하는 속도 레이서가 필요하다
$(window).scroll(function(){
if(lastLeftLocation > $(document).scrollLeft()) {
$('.images').each(function(){
if($(this).position().left >= $(this).attr('loc')){
console.log("0 == stopped");
}
else {
speedR = $(this).attr('speed-racer');
$(this).css({left : "+="+speedR});
$(this).attr('racer-offset') + speedR;
$(this).attr('racer-offset', $(this).attr('speed-racer') + $(this).attr('racer-offset'));
}
});
}
else {
$('.images').each(function(){
if($(this).attr('racer-offset') <= 0){
console.log("0 == stopped");
}
else {
speedR = $(this).attr('speed-racer');
$(this).css({left : "-="+speedR});
$(this).attr('racer-offset', $(this).attr('racer-offset') - speedR);
}
});
}
});
NEW VERSION if 부분.
$(this).attr('racer-offset', $(this).attr('speed-racer') + $(this).attr('racer-offset'));
나는 그것을 바꿀 필요가 있다고 생각한다. 내가해야 할 일은 왼쪽 움직임이라고 불리는 레이서 오프셋의 복사본을 만든 다음 0에 도달 할 때까지 레이서 오프셋에서 빼는 것입니다. 0에 도달하면 멈추고 카운트 업으로 돌아갑니다. -하지만 +. – Cam