问题描述
当我单击链接时,字体大小在 iOS 上不会变大,但在 android 上它确实有效.我如何让它工作
When I click a link the font-size does not get bigger on iOS but on android it does work. How do I get it to work
我尝试过的:
ontouchstart="" 在 body 标签中
ontouchstart="" in the body tag
jQuery:
$(".primary-menu li a").on('click', function() {
$(this).css("font-size", "15px");
});
CSS:
.primary-menu li a:focus {
font-size: 15px !important;
}
jQuery 或 CSS 均不适用于 iOS,仅适用于 Android
Neither the jQuery or CSS Works on the iOS only Android
谢谢
推荐答案
我遇到了同样的问题,:focus
选择器无法工作(在我的情况下是在 button
上)在 iOS 上,这是我的解决方案:
I had the same problem of non working :focus
selector (in my case on a button
) on iOS and this is my solution:
<button onclick="this.focus()">Button</button>
所以有必要手动focus()
按钮onclick
(我不知道为什么).就我而言,这似乎只是可行的解决方案,在这里尝试了其他解决方案:https://jsfiddle.net/sz1L75ro/8/
So it is necessary to manually focus()
the button onclick
(I have no clue why). In my case it seemed to be to only working solution, tried others here:https://jsfiddle.net/sz1L75ro/8/
如果 threadstarter 出现问题,我建议也将相同的 onclick
侦听器添加到 a
元素:
In case of the problem of the threadstarter I would suggest to also add the same onclick
listener to the a
elements:
<a onclick="this.focus()">Link</a>
这篇关于CSS - :focus 不适用于 iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!