iamjpg / Ez-Background-Resize

Resizable full-browser background image using jQuery. Implementation requires no CSS.
http://johnpatrickgiven.com/jquery/background-resize/
89 stars 32 forks source link

this.width #4

Closed graphis closed 13 years ago

graphis commented 13 years ago

this.width does not work on the webkit based browsers, and if it would you will have issues with images wich are not 100% loaded

iamjpg commented 13 years ago

Actually, it does work in webkit browsers since "this" is directly referring to the image object passed by the user.

In the code, you'll now see that I'm pre-loading the image with a callback (thus the "this" reference) to get the objects height and width so the user of the plugin doesn't need to pass that info anymore.

These commits aren't on the master branch; they're on the develop branch until I've gotten the chance to test it on IE. Right now it's working in Safari, Chrome, and Firefox.

graphis commented 13 years ago

Hi,

maybe I am wrong, but it does not work on my mac os 10.6.x safari: 5.0.1

for a year I developem my own fullscrenn js thing and I tested a log of these solutions, I always hadd issues with this.width or heigth, wich is a jquery function as far as I remember.

try resizing the window on safari 5 (this is what I got currently at hand) it does not work


Sándor Zsolt designer 70 257 5720 ezsolt@gmail.com www.graphis.eu

On Mar 30, 2011, at 10:31 PM, iamjpg wrote:

Actually, it does work in webkit browsers since "this" is directly referring to the image object passed by the user.

In the code, you'll now see that I'm pre-loading the image with a callback (thus the "this" reference) to get the objects height and width so the user of the plugin doesn't need to pass that info anymore.

These commits aren't on the master branch; they're on the develop branch until I've gotten the chance to test it on IE. Right now it's working in Safari, Chrome, and Firefox.

Reply to this email directly or view it on GitHub: https://github.com/iamjpg/jQuery-Ez-Background-Resize/issues/4#comment_938128

iamjpg commented 13 years ago

So, "this" isn't a jQuery function. It's a pointer to the object being evaluated. In my plugin "this" is referencing the image object during the .load() callback. width and height are attributes available on the object (this.width, this.height).

Evaluating an object this way is standard across browsers.

RIght now, the only browser this plugin isn't working on is IE6 (and it never will). The tested browsers are:

IE7, IE8, Safari 5 (Mac and Windows), Chrome 10, FireFox 3 and 4.

I recently made a change which might fix the issue you're seeing with the plugin. I created a new GitHub page for testing the latest releases here:

http://iamjpg.github.com/jQuery-Ez-Background-Resize/

Hopefully you were looking at a bad build and this latest build fixes the issues you're seeing.

If you're still seeing problems, send me a screenshot of the page along with the error in the console? I would really appreciate it.

Cheers, J.P.