zoukankan      html  css  js  c++  java
  • mui-slider选项卡设置默认index

    今天mui框架选项卡遇到个无法设置初始index的问题,查阅网上资料后未发现解决方案。正确的解决方案是:

    1.设置头部和内容区域的.mui-active。

    2.*设置内容区域最外层设置偏移量transform,根据页面宽度适配。

    3:*进行silder滚动。(缺少这步会有滑动bug)

    以个人需求为例:(根据地址栏设定初始值)

    贴上代码:

    let currIndex = getUrlParam('item')
            console.log(currIndex)
            //根据导航栏进行定位--MuiBug
            $('.mui-control-item').removeClass('mui-active').eq(currIndex-1).addClass('mui-active')
            $('.mui-slider-group>div').removeClass('mui-active').eq(currIndex-1).addClass('mui-active')
            if(currIndex==1){
                $(`.mui-slider-group`).css('transform','translate3d(0px, 0px, 0px) translateZ(0px)')
            }else{
                let screenWidth = window.innerWidth 
                $(`.mui-slider-group`).css('transform',`translate3d(-${screenWidth}px, 0px, 0px) translateZ(0px)`)
           mui('.mui-slider').slider().gotoItem(currIndex);
            }
    生活不止眼前的苟且,还有车和买房
  • 相关阅读:
    「CH6801」棋盘覆盖
    「POJ3613」Cow Relays
    「Luogu4556」Vani有约会-雨天的尾巴
    The Proof of Fibonacci GCD
    Ubuntu flatabulous 主题
    CSP-S 2019 复赛游记
    「Luogu1402」酒店之王
    HDU/5499/模拟
    cfedu/A/求和
    HDU<1372>/bfs
  • 原文地址:https://www.cnblogs.com/xiaokar/p/13853068.html
Copyright © 2011-2022 走看看