gpt4 book ai didi

javascript - removeAttribute ('style' ) 在 iOS 中不起作用,如何修复?

转载 作者:行者123 更新时间:2023-11-30 12:56:32 24 4
gpt4 key购买 nike

我有网站的移动版本。我使用 touchemove 事件通过 -webkit-transform 向左和向右移动页面。此转换是元素的内联属性。在 touchend 上,我使用 document.getElementById('element').removeAttribute("style"); 但它不适用于手机和平板电脑。

如何解决?谢谢!

最佳答案

有时,如果您一次进行更多更改,removeAttribute 似乎不起作用。而是使用像这样的 setAttribute 方法:

document.getElementById('element').setAttribute('style','');

removeAttribute 之前调用 getAttribute 似乎也可以,但我建议不要删除默认属性。

Source

关于javascript - removeAttribute ('style' ) 在 iOS 中不起作用,如何修复?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18916402/

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