Hbuilder MUI页面无法滚动

图片描述

如图所示,怎么都无法让页面滚动,但是侧滑的导航里面的内容就能滚动。 写法都一样的,不知道怎么回事,求大牛指教!!!

代码:

<!DOCTYPE html>
<html>

    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
        <title></title>
        <link href="css/mui.css" rel="stylesheet" />
        <link href="css/font-awesome.min.css" rel="stylesheet" />
        <style type="text/css">
            .userAvatar .mui-table-view:before,
            .userAvatar .mui-table-view:after,
            .userAvatar .mui-table-view-cell:before,
            .userAvatar .mui-table-view-cell:after {
                background-color: transparent;
            }
            
            .mem-nav-h {
                display: flex;
                text-align: center;
                background-color: #2E374D;
                padding: 10px 0;
            }
            
            .mem-nav-h div {
                flex: 1;
            }
        </style>
    </head>

    <body>
        <!-- 主界面菜单同时移动 -->
        <!-- 侧滑导航根容器 -->
        <div class="mui-off-canvas-wrap mui-draggable">
            <!-- 主页面容器 -->
            <div class="mui-inner-wrap">
                <!-- 菜单容器 -->
                <aside class="mui-off-canvas-left" id="offCanvasSide" style="background-color: #1D263C;color: white;">
                    <div class="mui-scroll-wrapper" style="margin-bottom: 25px;">
                        <div class="mui-scroll userAvatar">
                            <!-- 菜单具体展示内容 -->
                            <ul class="mui-table-view" style="background-color: transparent;margin-top: 45px;border: 0 none;">
                                <li class="mui-table-view-cell mui-media">
                                    <a href="javascript:;">
                                        <img class="mui-media-object mui-pull-left" src="images/shuijiao.jpg" style="border-radius: 50%;border: 2px solid white;max-width: 60px;height: 60px;">
                                        <div class="mui-media-body" style="margin-top: 10px;">
                                            伊泽瑞尔
                                            <div>
                                                <i class="fa fa-circle" aria-hidden="true" style="color: #AA7B51;"></i> 青铜
                                                <i class="fa fa-star" aria-hidden="true" style="color: #AA7B51;"></i>
                                                <i class="fa fa-star" aria-hidden="true" style="color: #AA7B51;"></i>
                                                <i class="fa fa-star" aria-hidden="true" style="color: #AA7B51;"></i>
                                            </div>
                                        </div>
                                    </a>
                                </li>
                                <li class="mui-table-view-cell">
                                    <a href="javascript:;">
                                        "为了更美好的明天而战"
                                    </a>
                                </li>
                            </ul>
                            <div class="mem-nav-h">
                                <div>
                                    <div>1000</div>
                                    <div>积分</div>
                                </div>
                                <div>
                                    <div>500</div>
                                    <div>鱼豆</div>
                                </div>
                                <div>
                                    <div>20</div>
                                    <div>粉丝</div>
                                </div>
                                <div>
                                    <div>10</div>
                                    <div>关注</div>
                                </div>
                            </div>
                            <ul class="mui-table-view" style="background-color: transparent;">
                                <li class="mui-table-view-cell"><i class="fa fa-star" aria-hidden="true" style="color: #AA7B51;"></i>我的角色 <span class="mui-badge mui-badge-danger">14</span></li>
                                <li class="mui-table-view-cell">我的约战<span class="mui-badge mui-badge-danger">1</span></li>
                                <li class="mui-table-view-cell">我的竞猜<span class="mui-badge mui-badge-danger">5</span></li>
                                <li class="mui-table-view-cell" style="border-bottom: 1px solid #292C33;">排行榜</li>
                                <li class="mui-table-view-cell">我的消息<span class="mui-badge mui-badge-danger">5</span></li>
                                <li class="mui-table-view-cell">我的评论</li>
                                <li class="mui-table-view-cell">我的账户</li>
                            </ul>
                        </div>
                        <div style="position: fixed;bottom: 0;">设置</div>
                    </div>
                </aside>
                <!-- 主页面标题 -->
                <header class="mui-bar mui-bar-nav" style="background-color: rgb(29, 38, 60);">
                    <a class="mui-icon mui-action-menu mui-icon-bars mui-pull-left" href="#offCanvasSide"></a>
                    <h1 class="mui-title">新闻资讯</h1>
                    <a><span class="mui-icon mui-icon-search mui-pull-right" style="color: white;"></span></a>
                </header>
                <nav class="mui-bar mui-bar-tab">
                    <a class="mui-tab-item mui-active">
                        <span class="mui-icon mui-icon-home"></span>
                        <span class="mui-tab-label">新闻</span>
                    </a>
                    <a class="mui-tab-item">
                        <span class="mui-icon mui-icon-phone"></span>
                        <span class="mui-tab-label">竞猜</span>
                    </a>
                    <a class="mui-tab-item">
                        <span class="mui-icon mui-icon-email"></span>
                        <span class="mui-tab-label">约战</span>
                    </a>
                    <a class="mui-tab-item">
                        <span class="mui-icon mui-icon-gear"></span>
                        <span class="mui-tab-label">赛事</span>
                    </a>
                    <a class="mui-tab-item">
                        <span class="mui-icon mui-icon-gear"></span>
                        <span class="mui-tab-label">战队</span>
                    </a>
                </nav>
                <!-- 主页面内容容器 -->
                <div class="mui-content">
                    <div class="mui-scroll-wrapper">
                        <div class="mui-scroll">
                            <!-- 主界面具体展示内容 -->
                            <div id="slider" class="mui-slider ">
                                <div class="mui-slider-group mui-slider-loop">
                                    <!-- 额外增加的一个节点(循环轮播:第一个节点是最后一张轮播) -->
                                    <div class="mui-slider-item mui-slider-item-duplicate">
                                        <a href="#">
                                            <img src="images/yuantiao.jpg">
                                            <p class="mui-slider-title">静静看这世界</p>
                                        </a>
                                    </div>
                                    <div class="mui-slider-item">
                                        <a href="#">
                                            <img src="images/shuijiao.jpg">
                                            <p class="mui-slider-title">幸福就是可以一起睡觉</p>
                                        </a>
                                    </div>
                                    <div class="mui-slider-item">
                                        <a href="#">
                                            <img src="images/muwu.jpg">
                                            <p class="mui-slider-title">想要一间这样的木屋,静静的喝咖啡</p>
                                        </a>
                                    </div>
                                    <div class="mui-slider-item">
                                        <a href="#">
                                            <img src="images/cbd.jpg">
                                            <p class="mui-slider-title">Color of SIP CBD</p>
                                        </a>
                                    </div>
                                    <div class="mui-slider-item">
                                        <a href="#">
                                            <img src="images/yuantiao.jpg">
                                            <p class="mui-slider-title">静静看这世界</p>
                                        </a>
                                    </div>
                                    <!-- 额外增加的一个节点(循环轮播:最后一个节点是第一张轮播) -->
                                    <div class="mui-slider-item mui-slider-item-duplicate">
                                        <a href="#">
                                            <img src="images/shuijiao.jpg">
                                            <p class="mui-slider-title">幸福就是可以一起睡觉</p>
                                        </a>
                                    </div>
                                </div>
                                <div class="mui-slider-indicator mui-text-right">
                                    <div class="mui-indicator mui-active"></div>
                                    <div class="mui-indicator"></div>
                                    <div class="mui-indicator"></div>
                                    <div class="mui-indicator"></div>
                                </div>
                            </div>
                            <ul class="mui-table-view">
                                <li class="mui-table-view-cell mui-media">
                                    <a href="javascript:;">
                                        <img class="mui-media-object mui-pull-left" src="images/shuijiao.jpg">
                                        <div class="mui-media-body">
                                            幸福
                                            <p class="mui-ellipsis">能和心爱的人一起睡觉,是件幸福的事情;可是,打呼噜怎么办?</p>
                                        </div>
                                    </a>
                                </li>
                                <li class="mui-table-view-cell mui-media">
                                    <a href="javascript:;">
                                        <img class="mui-media-object mui-pull-left" src="images/muwu.jpg">
                                        <div class="mui-media-body">
                                            木屋
                                            <p class="mui-ellipsis">想要这样一间小木屋,夏天挫冰吃瓜,冬天围炉取暖.</p>
                                        </div>
                                    </a>
                                </li>
                                <li class="mui-table-view-cell mui-media">
                                    <a href="javascript:;">
                                        <img class="mui-media-object mui-pull-left" src="images/cbd.jpg">
                                        <div class="mui-media-body">
                                            CBD
                                            <p class="mui-ellipsis">烤炉模式的城,到黄昏,如同打翻的调色盘一般.</p>
                                        </div>
                                    </a>
                                </li>
                                <li class="mui-table-view-cell mui-media">
                                    <a href="javascript:;">
                                        <img class="mui-media-object mui-pull-left" src="images/cbd.jpg">
                                        <div class="mui-media-body">
                                            CBD
                                            <p class="mui-ellipsis">烤炉模式的城,到黄昏,如同打翻的调色盘一般.</p>
                                        </div>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
    <script src="js/mui.min.js"></script>
    <script>
        mui.init({
            swipeBack: true //启用右滑关闭功能
        });
        mui('.mui-scroll-wrapper').scroll();
        var slider = mui("#slider");
        slider.slider({
            interval: 1000
        });
    </script>

</html>
阅读 32.7k
13 个回答

猜测可能是:

<div class="mui-scroll-wrapper">
    <div class="mui-scroll">
        ...
    </div>
</div>

这个的原因,这个在案例里面是做上拉下拉刷新用的。

mui('.mui-scroll-wrapper').scroll({

        deceleration: 0.0005 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006
    });

怎么解决的?我也遇到这个问题 mui('.mui-scroll-wrapper').scroll({deceleration: 0.0005});
加了也没效果

初始化一下就可以了
mui.init();

(function($){
    $(".mui-scroll-wrapper").scroll({
        //bounce: false,//滚动条是否有弹力默认是true
        //indicators: false, //是否显示滚动条,默认是true
    });
    
})(mui);
新手上路,请多包涵

<div id="offCanvasContentScroll" class="mui-content mui-scroll-wrapper">

                <div class="mui-scroll" id="mui-scroll-content">
                    <div class="mui-content-padded">
                    

把mui-content-padded的高度增加一些,赋值给mui-scroll。

新手上路,请多包涵

去掉包裹div的mui-draggable类名

新手上路,请多包涵

大神你解决了吗 我遇到同样的问题了 谢谢

新手上路,请多包涵


<div id="offCanvasContentScroll" class="mui-content mui-scroll-wrapper">
你的内容
</div>
后面加上

            <!-- off-canvas backdrop -->
            <div class="mui-off-canvas-backdrop"></div>    
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏