1.IOS下调取键盘后position:fixed;失效问题解决办法:
方法一:
$(function(){
$('#phone').bind('focus',function(){
$('.bottom_fix').css('position','static'); //需要fixed定位的元素
//或者$('#viewport').height($(window).height()+'px');
}).bind('blur',function(){
$('.bottom_fix').css({'position':'fixed','bottom':'0'}); //需要fixed定位的元素
//或者$('#viewport').height('auto');
});
$('.bottom_fix').css('position','static'); //需要fixed定位的元素
//或者$('#viewport').height($(window).height()+'px');
}).bind('blur',function(){
$('.bottom_fix').css({'position':'fixed','bottom':'0'}); //需要fixed定位的元素
//或者$('#viewport').height('auto');
});
})
方法二:
document.getElementById(“test”).scrollIntoView();
2.click点击后会延迟30ms
3.:active伪类是在类似'mousedown'事件触发的时机生效的,而手机上并没有'mousedown'事件,取而代之的只有'touchstart'和'touchend'。
var a = document.getElementsByTagName('a'); for(var i = 0; i < a.length; i++) { a[i].addEventListener('touchstart',function(){},false); }