jquery 1.4.2 working for iCheckBox and not jquery 1.6

旧街凉风 提交于 2019-12-20 06:13:49

问题


I am using this jquery plugin for Apple like checkbox button.

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.

I tried debugging javascript using IE9 developer toolbar but it is not throwing any error.

Thank you.


回答1:


EDIT: got it working in FF4 as well now, see this: jQuery 1.6: backgroundPosition vs backgroundPositionX and FF4 compatibility

Got it working with jQuery 1.6.x and 1.5.x (in Safari and Chrome on Mac, not working in FF4/Mac)

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.

The first problem was the use of the

backgroundPosition property 

in the animate calls, they needed to be changed into the

backgroundPositionX property

for jQuery 1.5 and 1.6

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 )

but in jQuery 1.6 this does not work, it need to be changed into

if ( $(this).is(':checked') )

The code found here works for jQuery 1.6: http://jsfiddle.net/mikkelbreum/HAGMp/




回答2:


Try updating to jQuery 1.6.1. With 1.6, they broke backwards compatibility with .attr() (which breaks many plugins) but the 1.6.1 update addresses this.



来源:https://stackoverflow.com/questions/6032538/jquery-1-4-2-working-for-icheckbox-and-not-jquery-1-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!