jQuery 1.4.2适用于iCheckBox而非jQuery 1.6 [英] jquery 1.4.2 working for iCheckBox and not jquery 1.6
问题描述
我正在为苹果使用此 jquery插件,如复选框按钮.
I am using this jquery plugin for Apple like checkbox button.
但是,当我使用1.4.2版的jquery时,它可以很好地工作,但是当我尝试使用1.6版的jquery时,它可以正常工作.该插件不起作用.
However when I use jquery version 1.4.2 it works perfectly but when I try to use jquery version 1.6. that plugin doesn't work.
我尝试使用IE9开发人员工具栏调试javascript,但未引发任何错误.
I tried debugging javascript using IE9 developer toolbar but it is not throwing any error.
谢谢.
推荐答案
现在它也可以在FF4中运行,请参见: jQuery 1.6:backgroundPosition与backgroundPositionX和FF4兼容性
got it working in FF4 as well now, see this: jQuery 1.6: backgroundPosition vs backgroundPositionX and FF4 compatibility
可以与jQuery 1.6.x和1.5.x一起使用 (在Mac上的Safari和Chrome中,在FF4/Mac中不起作用)
Got it working with jQuery 1.6.x and 1.5.x (in Safari and Chrome on Mac, not working in FF4/Mac)
原始代码存在两个问题,一个使它与jQuery 1.5和1.6不兼容,另一个使它与jQuery 1.6不兼容.
There were two problems with the original code, one making it incompatible with jQuery 1.5 and 1.6 and one making it incompatible with jQuery 1.6.
第一个问题是
backgroundPosition property
在动画通话中,需要将其更改为
in the animate calls, they needed to be changed into the
backgroundPositionX property
对于jQuery 1.5和1.6
for jQuery 1.5 and 1.6
第二个问题是检查该复选框是否被选中. 在jQuery 1.4和1.5中,可以使用
The second problem was the check for whether the checkbox is checked or not. In jQuery 1.4 and 1.5 this could be done with
if ( $(this).attr('checked') == true )
但是在jQuery 1.6中这是行不通的,需要将其更改为
but in jQuery 1.6 this does not work, it need to be changed into
if ( $(this).is(':checked') )
此处找到的代码适用于jQuery 1.6: http://jsfiddle.net/mikkelbreum/HAGMp/
The code found here works for jQuery 1.6: http://jsfiddle.net/mikkelbreum/HAGMp/
这篇关于jQuery 1.4.2适用于iCheckBox而非jQuery 1.6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!