zoukankan      html  css  js  c++  java
  • MUI scroll 定位问题

    做一个微信项目,使用MUI做框架,在使用scroll定位的时候,出现了定位不准确的问题,查询了好多资料,得知他是相对定位。折腾了好久,才搞定,现在做一个笔记。

     mui('body').on('tap', 'a', function (e) {
                var data = this.getAttribute('val');
                mui('.mui-scroll-wrapper').scroll().reLayout();//重新计算布局值,最大滚动的高度等等
                let y = 0;
                let current_top = mui('.mui-scroll-wrapper').scroll().y;
                switch (data) {
                    case 'p'://商品
                        mui('.mui-scroll-wrapper').scroll().scrollTo(0, y, 100);
                        break;
                    case 'i'://简介
                        y = $('#dvpintro').offset().top-120; //计算位置
                        y = parseInt(current_top - y);
                        if (y > 0)
                            y = -y;
                        mui('#scroll1').scroll().scrollTo(0, y , 100);
                        break;
                    case 't': //套餐
                        y = $('#dvpintro').offset().top + (- 1700);//计算位置
                        y = current_top - y;
                        if (y > 0)
                            y = -y;
                        mui('.mui-scroll-wrapper').scroll().scrollTo(0, y, 100);
                        break;
                }
            }); 
    

     出事位置

    参考文章:http://blog.csdn.net/sbt0198/article/details/51755843

    http://www.cnblogs.com/CyLee/p/5324622.html

     

  • 相关阅读:
    UVA 12545 Bits Equalizer
    UVA 1610 Party Games
    UVA 1149 Bin Packing
    UVA 1607 Gates
    UVA 12627 Erratic Expansion
    UVA10562-Undraw the Trees(递归)
    UVA10129-Play on Words(欧拉路径)
    UVA816-Abbott's Revenge(搜索进阶)
    UVA1103-Ancient Messages(脑洞+dfs)
    UVA839-Not so Mobile
  • 原文地址:https://www.cnblogs.com/ganqiyin/p/7660812.html
Copyright © 2011-2022 走看看