Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE issue with NaN on parseFloat($correctionParent.css('border-top-width')) #30

Open
metadan opened this issue Sep 28, 2010 · 1 comment

Comments

@metadan
Copy link

metadan commented Sep 28, 2010

I've integrated quicksand into a site i'm working on and came across this issue...

I've fixed it but how do i submit a fix to the code (if my fix is ok, and it is deemed a bug that is ofcourse)?

Regards,
Dan

BASE:
correctionOffset.top -= parseFloat($correctionParent.css('border-top-width'));
correctionOffset.left -= parseFloat($correctionParent.css('border-left-width'));

FIX:
var bTopWidth = parseFloat($correctionParent.css('border-top-width'));
if ( !isNaN(bTopWidth) ) {
correctionOffset.top -= bTopWidth;
}
var bLeftWidth = parseFloat($correctionParent.css('border-left-width'));
if ( !isNaN(bLeftWidth) ) {
correctionOffset.left -= bLeftWidth;
}

@zfloyd
Copy link

zfloyd commented Dec 10, 2010

Thank you for posting your fix metadan. I implemented it and it fixed a JS error that quicksand was throwing, but the items were not being animated. I modified your code as follows and it seemed to have fixed it completely.

        var bTopWidth = parseFloat($correctionParent.css('border-top-width'));
        var bLeftWidth = parseFloat($correctionParent.css('border-left-width'));
        if ($correctionParent.css('position') == 'relative') {
            if ($correctionParent.get(0).nodeName.toLowerCase() == 'body') {

            } else {
                if (!isNaN(bTopWidth))
                    correctionOffset.top += bTopWidth;
                if (!isNaN(bLeftWidth))
                    correctionOffset.left += bLeftWidth;
            }
        } else {                
            if (!isNaN(bTopWidth))
                correctionOffset.top -= bTopWidth;              
            if (!isNaN(bLeftWidth))
                correctionOffset.left -= bLeftWidth;

            correctionOffset.top -= parseFloat($correctionParent.css('margin-top'));
            correctionOffset.left -= parseFloat($correctionParent.css('margin-left'));
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants