在iOS8之前的所有版本中,当键盘以下列方式出现时,我能够阻止iPhone键盘向上推起(并销毁)我的html/css/js视图:
$('input, select').focus(function(event) {
$(window).scrollTop(0);
// or via the scrollTo function
});
从iOS8开始,这就不再起作用了。解决方法之一是将此代码放置在setTimeOut中。
setTimeout(function() { $(window).scrollTop(0); }, 0);
但是,它只使视图执
当客户端在select选项之间移动时,为什么不触发键盘事件?还有其他的活动吗?
如何复制:
集中注意select元素。
打开选择选项。
使用键盘(上/下)箭头移动选择选项。
结果:当您使用上/下键盘键移动这些选项时,没有发送任何事件。
HTML
<!-- The second value will be selected initially -->
<select name="text"> <!--Supplement an id here instead of using 'text'-->
<
如何不仅直接单击鼠标,而且按键盘上的按钮(在本例中,它是s a keyboard button with a value "1" that hasevent.key`=1)?
new Vue({
el: "#app",
data: {
one: 1
},
methods: {
add(){
this.one++;
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></scr