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

Image refetched when window is resized #27

Open
Jakobud opened this issue Jun 28, 2013 · 1 comment
Open

Image refetched when window is resized #27

Jakobud opened this issue Jun 28, 2013 · 1 comment

Comments

@Jakobud
Copy link

Jakobud commented Jun 28, 2013

I have a weird issue I can't figure out. I have the following code:

<div class='atv tablet' data-r769="<img src='/img/atv.png'/>"></div>

So when my screen width hits 769px, the atv image is loaded into the div. Works perfectly. However I've noticed that if I resize my browser window, making is smaller then wider, then smaller then wider, etc.... each time the 769px breakpoint is hit, the browser loads the file again. However it's cached, so it doesn't actually download it again, but it still tries to fetch it and gets a 304 not modified response:

You can see the atv.png file loaded multiple times from when I was resizing the window back and forth.

I have yet to be able to recreate this problem on jsfiddle and my current code is on a private server. Any clues as to why this would be happening?

Here is my Response code:

Response.create({
    prop: "width",
    prefix: "r",
    breakpoints: [0, 769, 1025]
});
@Jakobud
Copy link
Author

Jakobud commented Jun 28, 2013

Correction: I recreated the problem here:

http://jsfiddle.net/N2Mtj/3/

Simply resize the window back and forth with the Chrome Dev Tools open and you will see it keeps trying to fetch the image.

Is this normal expected behavior? Is this because Responsejs if recreating the image dom element each time? Shouldn't it cache them or something so the browser doesn't keep trying to download the same file?

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

1 participant