简体   繁体   English

在iPhone / Android上运行jQuery show()/ hide()吗?

[英]Does jQuery show() / hide() on iPhone / Android work?

I've been testing a website on mobile devices which uses a simple hide() / show() on a form. 我一直在移动设备上测试一个网站,它在表单上使用了一个简单的hide()/ show()。 Works great on the desktop but not at all on mobile devices. 在桌面上运行良好但在移动设备上完全没有。 Does anyone know if the functions are supported? 有谁知道这些功能是否受支持?

Using jQuery 1.5 使用jQuery 1.5

Thanks 谢谢

Ric 里克

是的,jQuery在iPhone和Android上运行良好。

yes works fine, I had done in many projects for smartphones (iPhone, Android) specially and works as charm 是的,工作得很好,我曾在智能手机(iPhone,Android)的许多项目中做过特别的工作,并作为魅力

you can be sure for this, because, new mobile web framework, jQtouch, and jQuery mobile is in jQuery and alot others too. 你可以肯定的是,因为新的移动web框架,jQtouch和jQuery mobile都在jQuery中,而且还有很多其他的。

Ric I wouldn't say that combining all of the JS files together is really that bad of a solution, in fact I think that minifying and combining JS code is a great practice, unless you need people to be able to read your JS from source for some reason. Ric我不会说将所有JS文件组合在一起实际上是一个糟糕的解决方案,事实上我认为缩小和组合JS代码是一个很好的做法,除非你需要人们能够从源代码中读取你的JS由于某些原因。 Glad you got it fixed. 很高兴你修好了它。

Okay, this is a terrible answer and thanks to everyone for their help. 好的,这是一个可怕的答案,感谢大家的帮助。

In the end I combined all the JS files together. 最后,我将所有JS文件组合在一起。 This fixed the script execution order problem on iPhone / Android. 这修复了iPhone / Android上的脚本执行顺序问题。 I'm not sure why it was happening on this particular site, and only on mobile phones. 我不确定为什么它会在这个特定的网站上发生,而且只在手机上发生。

It's not a very elegant solution and I do not recommend it. 这不是一个非常优雅的解决方案,我不推荐它。 In my case it was for a temporary microsite so decided it was acceptable. 在我的情况下,这是一个临时的微型网站,所以决定它是可以接受的。 Should I discover more about the problem I will post it here. 我是否应该发现有关此问题的更多信息,我将在此处发布。

As Colt pointed out I was a bit rash saying it wasn't en elegant solution combining all the files together. 正如柯尔特所指出的那样,我有点轻率地说这并不是将所有文件组合在一起的优雅解决方案。 In fact it is just what you should be doing! 事实上,这正是你应该做的! My frustration was that desktop and mobile browsers handled the JS different, and when developing the site I don't combine/minify the files until I know they work. 令我沮丧的是桌面和移动浏览器处理JS的方式不同,在开发网站时我不会合并/缩小文件,直到我知道它们有效。 Makes debugging and updating libraries easier. 使调试和更新库更容易。

As I feel bad for suggesting poor advice here's a little top tip: When on the production server I use Smart Optimizer (http://farhadi.ir/works/smartoptimizer) to handle joining, minifying, GZipping and caching the files for me. 由于我觉得建议糟糕的建议不好,这里有一个小技巧:在生产服务器上,我使用Smart Optimizer(http://farhadi.ir/works/smartoptimizer)为我处理加入,缩小,GZipping和缓存文件。 Means my dev code remains nicely seperated and it's easy to up jQuery, plugins etc but on the live site everything is nicely stuck together. 意味着我的开发代码仍然很好地分离,并且很容易升级jQuery,插件等,但在现场网站上,一切都很好地粘在一起。

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

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