20180723

-webkit-overflow-scrolling: touch;    ios 滚动

判断微信浏览器 micromessenger

背景不滚动

    watch: {
      picker3(){
        if(this.picker3){
          document.querySelector('body').style.position='fixed'
          document.querySelector('body').style.width='100%'
        }else{
          document.querySelector('body').style.position='initial'
          document.querySelector('body').style.width='auto'
        }
      }
    },

 requestAnimationFrame 替换setTimeout 不需要设置时间间隔

<div id="myDiv" style="background-color: lightblue;width: 0;height: 20px;line-height: 20px;">0%</div>
<button id="btn">run</button>
<script>
var timer;
btn.onclick = function(){
    myDiv.style.width = '0';
    cancelAnimationFrame(timer);
    timer = requestAnimationFrame(function fn(){
        if(parseInt(myDiv.style.width) < 500){
            myDiv.style.width = parseInt(myDiv.style.width) + 5 + 'px';
            myDiv.innerHTML =     parseInt(myDiv.style.width)/5 + '%';
            timer = requestAnimationFrame(fn);
        }else{
            cancelAnimationFrame(timer);
        }    
    });
}
</script>

猜你喜欢

转载自www.cnblogs.com/gyz418/p/9353176.html
今日推荐