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

Not getting correct padding values for image #27

Open
youradds opened this issue Feb 10, 2014 · 1 comment
Open

Not getting correct padding values for image #27

youradds opened this issue Feb 10, 2014 · 1 comment

Comments

@youradds
Copy link

First of all, great plugin.. thanks! (saved me a lot of time coding my own). I did notice one bug with Bootstrap 3, using the img-polaroid class. This adds padding to the image, as well as a border. Your getImgProperty almost works... but I had to tweak it to also take into account the padding. Please see my revised code below:

    function getImgProperty( img )
    {
        $img = $(img);
        var params =  new Array();
        params["w"] = (parseFloat($img.css("border-left-width")) + parseFloat($img.css("border-right-width")) + parseFloat($img.css("padding-left")) + parseFloat($img.css("padding-right")));
        params["h"] = (parseFloat($img.css("border-top-width")) + parseFloat($img.css("border-bottom-width")) + parseFloat($img.css("padding-top")) + parseFloat($img.css("padding-bottom")));
        return params;
    }

Thanks!

@ed-lea
Copy link
Owner

ed-lea commented Feb 12, 2014

thanks so much for taking the time to write in. I'll give your code a go. Cheers!

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