移动端开发复习

1.禁止默认事件

document.addEventListener("touchstart",function(ev){

  ev=ev||event;

  ev.preventDefault();

})

需要使用默认事件的元素上用ev.stopPropagation()阻止冒泡事件.

2.禁止电话与邮箱

<meta name="format-detection" content="telephone=no,email=no"/>

在需要使用此功能的地方

电话:<a href="tel:9090980">9090980</a>

邮箱:<a href="mailto:9090980@163.com">9090980@163.com</a>

3.a标签点击高亮去除

-webkit-tap-highlight-color:rgba(0,0,0,0)

4.button的圆角处理

-webkit-appearance:none;

5.font boosting

max-height:999999

 

6.1px的实现(伪元素)

<div class="border-top"></div>

.boder-top{

  position:relative

}

.border-top:before{

  content:"";

  display:block;

  position:absolute;

  top:0;

  left:0;

  height:1px

  background:#000;

  width:100%;

}

@media only screen and(-webkit-device-pixel-ratio:2){

  .border-top:before{

    transform:scaleY(.5);

  }

}

@media only screen and(-webkit-device-pixel-ratio:3){

  .border-top:before{

    transform:scaleY(.3333);

  }

}

其他方向同理

 7.事件点透 touchstart touchend click(移动端300ms)

posted @ 2018-09-09 15:51  杨小coding  阅读(108)  评论(0编辑  收藏  举报