Scroll JQuery Mobile Panel Separately From Content

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 05:59:19

This was driving me crazy as well. I used the solution on this forum response

Add this CSS after the JQueryMobile stylesheet:

    .ui-panel.ui-panel-open {
        position:fixed;
    }
    .ui-panel-inner {
        position: absolute;
        top: 1px;
        left: 0;
        right: 0;
        bottom: 0px;
        overflow: scroll;
        -webkit-overflow-scrolling: touch;
    }
  .ui-panel.ui-panel-open {
    position:fixed;
}
.ui-panel-inner {
    position: absolute;
    top: 1px;
    left: 0;
    right: 0;
    bottom: 0px;
    overflow: scroll;
    -webkit-overflow-scrolling: touch;
}

This is the solution provided by Alison Tinker. To prevent the Scroll from showing when there is nothing to scroll, change;

overflow: scroll;

to

overflow: auto;

I have similar case with you. I need a static menu at the left-side panel. I don't want the panel, scrolling.

Then, i use data-position-fixed="true".

I think you have to fix the content when the panel is open

to check if the panel is open , u have this class added to BODY .ui-panel.ui-panel-open

You have to set position : fixed !important; to the .ui-panel-wrapper under the .ui-panel.ui-panel-open

Please refer my solution using dynamic css settings triggered with panelbeforeopen/panelbeforeclose using the above stylesheet for inner panel.

$(document).on("panelbeforeopen", "#panel", function () { $(".ui-panel").css({ "overflow": "hidden" }); $(".ui-content").css({ "overflow": "hidden", "position": "fixed" }); }).on("panelbeforeclose", "#panel", function () { $(".ui-panel").css({ "overflow": "hidden" }); $(".ui-content").css({ "overflow": "scroll", "position": "absolute" }); });

http://jsfiddle.net/ohxdtwga/

Sticked footer update:

http://jsfiddle.net/u92m7u2n/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!