简体   繁体   English

Javascript切换按钮在iPhone上不起作用

[英]Javascript toggle button not working on iPhone

I'm developing a mobile site with the jquery mobile framework and have encountered a problem with showing/hiding a div when a javascript onclick event is activated. 我正在使用jquery移动框架开发移动网站,并且在激活javascript onclick事件时遇到了显示/隐藏div的问题。 It works fine in my desktop safari browser (and other desktop broswers), yet not on iPhone's version of safari. 在我的桌面浏览器浏览器(和其他桌面浏览器)中,它可以正常工作,但在iPhone版本的浏览器中却无法正常工作。

The page in question is: 有问题的页面是:

http://m.bestoddsindia.com/odds/#/odds/cricket/competitions-level1/competitions-level2/competitions-level3/bookmakers-outright-odds.php?comp1=New%20Zealand%20V%20South%20Africa%20Tests&markettype=2&bettype=Series%20Correct%20Score http://m.bestoddsindia.com/odds/#/odds/cricket/competitions-level1/competitions-level2/competitions-level3/bookmakers-outright-odds.php?comp1=New%20Zealand%20V%20South%20Africa% 20Tests&markettype = 2&bettype = Series%20Correct%20Score

When working properly, clicking on any of the list links will display more content directly below. 正常工作后,单击任何列表链接将在下面直接显示更多内容。 I was wondering if there was some kind of conflict between the javascript and the jquery mobile library when in the iPhone environment. 我想知道在iPhone环境中javascript和jquery移动库之间是否存在某种冲突。

You can view the basic code structure here: http://jsfiddle.net/bestoddsglobal/vxdCL/21/ 您可以在此处查看基本代码结构: http : //jsfiddle.net/bestoddsglobal/vxdCL/21/

(Note it doesn't work in the jsfiddle environment either!) (请注意,它在jsfiddle环境中也不起作用!)

As you have jQuery referenced, you can change the toggle function to this: 引用了jQuery后,您可以将toggle函数更改为:

function toggle_display(strID)
{
    $('#' + strID).toggle();
    return false;
}

The documentation for this function is here 此功能的文档在这里

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

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