js工具方法

滚动距离

window.onscroll = function() {
        var t = document.documentElement.scrollTop || document.body.scrollTop;
        if(t <= 120) {
            $(".index-bar").css("display", "none");
        } else {
            $(".index-bar").css("display", "inline-block");
        }
    }

获取索引 记住加e 监听

for(var i = 0; i < btnList.length; i++) {
        btnList[i].index = i;
        btnList[i].addEventListener('tap', function(e) {

            var index = this.inedex;
        })

防止input导致UI向上位移

document.querySelector(".main-bar ").style.top = (plus.display.resolutionHeight - 50) + "px";

底部选项卡颜色

.mui-bar-tab .mui-tab-item.mui-active {
            color: #b0a464;
        }

css居中

position: fixed;
left: 50%;
top: 50%;
-webkit-transform:translate(-50%,-50%);
-moz-transform:translate(-50%,-50%);
-o-transform:translate(-50%,-50%);
-ms-transform:translate(-50%,-50%);
transform:translate(-50%,-50%);

你可能感兴趣的:(javascript,mui)