简体   繁体   English

仅当在devtools中单击时,Safari ios(iPhone和iPad)才能正常工作

[英]Safari ios (iphone and ipad) working properly only when clicking in devtools

I have this weird issue happening only in safari ios: 我有一个奇怪的问题,只发生在Safari ios中: 在此处输入图片说明

As you can see from the gif above (click on it to see it properly), the div is not moving unless I click on it in developer tools . 从上面的gif中可以看到(单击它可以正确看到它), 除非我在开​​发人员工具中单击它,否则div不会移动 I'm not changing any code and the div starts functioning correctly. 我没有更改任何代码,并且div开始正常运行。

Anyone have any ideas why this is happening on ios (not happening on desktop safari)? 任何人都知道为什么这会在ios上发生(而不是在桌面Safari上发生)吗?

I'm using transition: margin-left 500ms ease; 我正在使用transition: margin-left 500ms ease; on body and then change margin of the div (I keep the vendor prefix -webkit-). 在正文上,然后更改div的边距(我保留供应商前缀-webkit-)。

Thanks! 谢谢!

I've experienced a similar issue and it appears to be due to how Safari deals with jQuery animations. 我遇到了类似的问题,这似乎是因为Safari如何处理jQuery动画。

A workaround rather than a fix, but if you use jQuery.css() rather than jQuery.animation(), the issue shouldn't occur. 解决方法而不是解决方法,但是如果您使用jQuery.css()而不是jQuery.animation(),则不应发生此问题。 You can then use css animations instead. 然后,您可以改为使用CSS动画。 You could probably use css classes to set the margin-left and just add/remove a class using jQuery on click too. 您可能可以使用css类来设置margin-left,也只需在单击时使用jQuery添加/删除类。

Cheers 干杯

Matt 马特

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM