나는 /이 pageshow
및 orientationchange
이벤트에 iScroll 인스턴스를 새로 초기화합니다. 나는 data-role="content"
div에 클래스를 설정하여 스크롤 할 수있게하고 싶습니다 (이 경우에는 .content
클래스를 사용했습니다).
는
var myScroll = [];
$(document).delegate('[data-role="page"]', 'pageshow', function() {
if ($.mobile.activePage.find('.content').length > 0) {
if (this.id in myScroll) {
myScroll[this.id].refresh();
} else {
myScroll[this.id] = new iScroll($.mobile.activePage.find('.content')[0].id, {
hScroll : false,
vScroll : true,
hScrollbar : false,
vScrollbar : true,
fixedScrollbar : true,
fadeScrollbar : false,
hideScrollbar : false,
bounce : true,
momentum : true,
lockDirection : true
});
}
}
});
$(window).bind('orientationchange', function() {
if ($.mobile.activePage[0].id in myScroll) {
myScroll[$.mobile.activePage[0].id].refresh();
}
});
당신은 iscroll 전에 <스크립트 SRC = "http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.js"> JS로드합니까? – Adi
아니요 마지막으로로드하는 스크립트가 아닙니다. iScroll 인스턴스를 초기화하는 데 어려움이있는 경우 iScroll 사이트에서 예제를 따르고 있는지 확인하십시오. iScoll은 사용자가 호출하는 요소의 직접적인 하위 요소 만 스크롤합니다. – Jasper
JQM ajax 탐색과 함께 작동하지 않을 수 있습니다. 즉 iscroll is not working 페이지에 도달하면. 내가 그 페이지를 새로 고치면 잘 작동합니다 (모든 js를 다시 읽을 수 있기 때문에 추정 할 수 있습니다). 현재 iscroll js는 여전히 HTML의 머리글이며 js의 모든 페이지 이벤트에 없습니다. – Adi