gpt4 book ai didi

javascript - jQuery 模糊不适用于 iOS

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:02:49 25 4
gpt4 key购买 nike

我有一个简单的文本区域,如果我使用 iPad 或 iPhone 专注于它,焦点将停留在该文本区域上,直到我单击另一个字段或链接。我想删除点击其他元素的焦点,并在具有 contenteditable 属性的 div 上做同样的事情;所以,当我在某处阅读时,我试过这个:

$('body').click(function(e) {
if (!$('#text-to-change').is(e.target)) {
$('#text-to-change').blur();
} else {
$('#text-to-change').focus();
}
});

它不起作用...焦点停留在该文本区域上。

最佳答案

iOS 不支持手机上的焦点和模糊,对于模糊我找到了一个使用 CSS 的解决方案,如果有其他解决方案,请写下,我很感兴趣

CSS:

// search input box blur support

//iPhone 6 in portrait & landscape
@media only screen
and (min-device-width : 375px)
and (max-device-width : 667px) {
body { cursor: pointer; }
}

//iPhone 6 Plus in portrait & landscape
@media only screen
and (min-device-width : 414px)
and (max-device-width : 736px) {
body { cursor: pointer; }
}

// iPhone 5 & 5S in portrait & landscape
@media only screen
and (min-device-width : 320px)
and (max-device-width : 568px) {

body { cursor: pointer; }
}

关于javascript - jQuery 模糊不适用于 iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40639168/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com