iOS 设备有一个小问题。我有一个固定的标题,但是当向下滚动时,如果用户在标题位于其上方时单击输入链接,则标题会卡在该位置,直到键盘被隐藏。
一旦我隐藏键盘,标题就会重置。这是 iOS 设备的已知问题吗?是否有已知的解决方案?
由于更好的可用性,我想保留固定的 header ,并且将其设置为相对的将是最后的选择。
谢谢。
最佳答案
我为此找到了简单的解决方案:
if ( /iPhone|iPod|iPad/i.test(navigator.userAgent) ) {
$(document).on('focus', 'input, textarea', function()
{
$('header').css("position", 'absolute');
$('footer').css("position", 'absolute');
});
$(document).on('blur', 'input, textarea', function()
{
$('header').css("position", 'fixed');
$('footer').css("position", 'fixed');
});
}
关于jquery - 修复标题问题 iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19415517/