iCheckbox compatibility issue

plugin broken in jQuery 1.5.x and 1.6.x

by mikkelbreum

HTML

<script src="http://brynmosher.com/jquery.iCheckbox/jquery.iCheckbox.js"></script>
<input class="icheck" type="checkbox">
<br>
<p id="out">--</p>

CSS

.iCheckbox_container {
    height:27px;
    width:94px;
    position: relative;
    overflow: hidden;
}
.iCheckbox_switch {
    height:27px;
    width:94px;
    background-image:url(http://brynmosher.com/jquery.iCheckbox/images/iphone_switch.png); /* your actual slider image */
    background-repeat:none;
    background-position:0px;
}

JavaScript

var icheck_options = {
    switch_container_src: 'http://brynmosher.com/jquery.iCheckbox/images/iphone_switch_container.gif'
};
var initial_state = "off";

// the slide switch type checkbox
$('.icheck').iCheckbox(initial_state, icheck_options);
$('.icheck').change(function(e) {
    if ($(this).attr('checked') === true) {
        $('#out').text('ON');
    } else {
        $('#out').text('OFF');
    }
});