중간 지점을 사용하여 위치가있는 페이지를 아래로 스크롤하는 끈적 div를 만드는 페이지에서 작업 중입니다. : 해당 div의 하단에 도달 할 때까지 고정됩니다. $ .waypoints ('refresh')가 호출 될 때까지 im이 의도 한대로 작동하는 코드는 sticky div가 페이지 상단으로 점프하고 고정 된 위치를 잃습니다.Jquery Waypoints 새로 고침
을 Heres 코드 : #leftCol이 페이지를 아래로 스크롤하고 #content가 부모 DIV이다 사업부는
$('#content').waypoint(function(event, direction){
if (direction === 'down') {
$(this).removeClass('sticky').addClass('bottomed');
}
else {
$(this).removeClass('bottomed').addClass('sticky');
}
}, {
offset: function() {
return $('#leftCol').outerHeight() - $('#content').outerHeight();
}
}).find('#leftCol').waypoint(function(event, direction) {
$(this).parent().toggleClass('sticky', direction === "down");
event.stopPropagation();
});
.
내가 가진 CSS는 다음과 같습니다
#content {
width: 975px;
height: auto;
position: relative;
margin-top: 10px;
margin-bottom: 20px;
min-height: 800px;
}
#leftCol {
position: absolute;
width: 974px;
}
.sticky #leftCol {
position:fixed !important;
top:0 !important;
left: 50% !important;
width: 974px !important;
margin-left: -488px;
}
.bottomed #leftCol {
position: absolute !important;
bottom: 0px;
}
라고 $ .waypoints ('새로 고침') 많이 주시면 감사하겠습니다 때 #leftCol의 위치를 유지하는 방법에 어떤 아이디어.
감사
아, 정말 좋았어! 이렇게 빠른 응답을 주셔서 감사합니다 – user1258303
이것은 내 질문을 해결할 수있는 방법에 대한 힌트를 제공합니다. 창 크기 조정을 제외하고는 모든 것이 잘 작동합니다. http://stackoverflow.com/questions/18221351/debugging-jquery-waypoints-script-see-fiddle-cannot-find-bug –
내 대답의 첫 번째 줄을 다시 읽으십시오. 너 아직도 그 짓을하고있어. ** 래퍼 **가 웨이 포인트가되어야합니다. – imakewebthings