Carol
Carol

Reputation: 329

Jquery Mobile Panel scroll inside issues

Is it possible to make the JqueryMobile panel scroll inside but the page behind it stays static? I'm trying to create a big menu like facebook but the page always scrolls too and not only the content inside the panel.

I tried:

<style type="text/css">
    #mypanel {
       overflow: scroll !important;
    }
</style>

<div data-role="page" id="page">
    <div class="my-page-big-content">ALL THE CONTENT OF MY PAGE</div>

<div data-role="panel" id="mypanel" data-position="left" data-display="overlay" data-position-fixed="true">
    <div class="panel-header">
        <p>My Panel header<a href="#mypanel" data-rel="close">Close My Panel</a></p>
    </div>
    <div class="panel-content">
        <ul class="my-menu">
          <li><a href=#>Menu item 1</a></li>
          <li><a href=#>Menu item 1</a></li>
          <li><a href=#>Menu item 1</a></li>
          <li><a href=#>Menu item 1</a></li>
          <li><a href=#>Menu item 1</a></li>
        <ul>
    </div>
</div>
</div>
<script>
    $(document).bind('panelopen', function (e, data) {
        $('body').css("overflow", "hidden");
    });

    $(document).bind('panelclose', function (e, data) {
        $('body').css("overflow", "auto");
    });
</script>

Upvotes: 3

Views: 4514

Answers (2)

NrNazifi
NrNazifi

Reputation: 1651

you can set ui-panel-inner class in your css file and put it after JQM css in your page

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

Also, there is a good offer: Make panel and page content scroll independently

Upvotes: 2

Carol
Carol

Reputation: 329

Nevermind, wasnt working in android, and I found the reason:

https://code.google.com/p/android/issues/detail?id=6864

https://code.google.com/p/android/issues/detail?id=2911

Upvotes: 0

Related Questions