Biff MaGriff
Biff MaGriff

Reputation: 8241

jQuery - Invalid Argument on removeClass with delay in Internet Explorer

I am using jQuery 1.7 and jQuery UI 1.8.16

I made a js fiddle to show what I'm doing however it works fine. and it blows up in internet explorer. http://jsfiddle.net/MEDtE/4/

I think it may be related to my usage of the ui-darkness theme but I don't see why.

I traced the problem to the jQuery cur function

cur: function () {
    if (this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null)) {
        return this.elem[this.prop];
    }

    var parsed,
    r = jQuery.css(this.elem, this.prop);
    // Empty strings, null, undefined and "auto" are converted to 0,
    // complex values such as "rotate(1rad)" are returned as is,
    // simple values such as "10px" are parsed to Float.
    return isNaN(parsed = parseFloat(r)) ? !r || r === "auto" ? 0 : r : parsed;
}

backgroundPositionY apparently has a value of top from the jQuery.css() call and that value is returned.

jQuery thinks this value is a percentage and a NaN occurs.

Can I fix this?

Upvotes: 1

Views: 430

Answers (3)

Biff MaGriff
Biff MaGriff

Reputation: 8241

This is resolved in jQuery 1.7.1.
http://bugs.jqueryui.com/ticket/7915

Which came out on the 24th.... :-P

Upvotes: 0

DefyGravity
DefyGravity

Reputation: 6021

I have had mixed results using setTimeout with browser animations. I would keep this all within jQuery, and use jQuery's delay functionality. That should keep it the same across all browsers.

<script>
$(document).ready(function(){
  $('#myp').delay(500).removeClass('ui-state-highlight',1500);
});
</script>

Upvotes: 1

Funky Dude
Funky Dude

Reputation: 3967

whats that second argument doing there in removeClass. removeClass only takes 1 argument.

Upvotes: 0

Related Questions