각기 다른 HTML 페이지에서 패널을 사용하려고합니다.각각 다른 html로 jquery 모바일 패널
그리고이 샘플 패널 JS 코드는 JQM 웹 사이트에 있습니다.
/* panel */
$(document).on("pageinit", "#demo-page", function() {
$(document).on("swipeleft swiperight", "#demo-page", function(e) {
// We check if there is no open panel on the page because otherwise
// a swipe to close the left panel would also open the right panel (and v.v.).
// We do this by checking the data that the framework stores on the page element (panel: open).
if ($.mobile.activePage.jqmData("panel") !== "open") {
if (e.type === "swipeleft" ) {
$("#right-panel").panel("open");
} else if (e.type === "swiperight") {
$("#left-panel").panel("open");
}
}
});
});
문제는 각기 다른 HTML 페이지에 패널을 배치하려는 경우 어떻게 페이지 ID를 설정해야합니까? 예를 들어
, 나는
main.html 페이지 ID가 "#pageMain"about.html 기본 페이지 ID가 "#pageAbout"이며, gallery.html 페이지 ID입니다 ..... 같은 HTML 페이지가 "#gallery"
JS 코드를 수정하려면 어떻게해야합니까? 제발 도와주세요 ~
질문이 명확하지 않습니다. 이 코드가 단일 페이지와의 일치를 멈추기를 원한다면'# demo-page 'selector를'on()'에 넘기면됩니다. –
어느 jQM 버전을 사용하고 있습니까? 활성 페이지에서 패널을 열려면이'$ .mobile.activePage.find ("# right-panel") .panel ("open");과 $ .mobile.activePage.find ("# left-panel")를 추가하십시오. .panel ("open");' – Omar
나는 그 코드를 가지고 있지만 지금은 게시 할 수 없다. jqm 문서에서 데모 된 두 비트의 코드를 추가하여 여러 번 패널을 추가하지 않았는지 확인한 사례입니다. –