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

Export main() and Granular control of which image is used #13

Open
scottconnerly opened this issue Mar 11, 2013 · 1 comment
Open

Export main() and Granular control of which image is used #13

scottconnerly opened this issue Mar 11, 2013 · 1 comment

Comments

@scottconnerly
Copy link

I'll maybe try to fork the library and upload my version, but I haven't gotten to that point yet. In the mean time, please just look my implementation over:
http://blog.hilmor.com/wp-content/themes/retool/_inc/srcset.js

The biggest needs I had for the library were:

  • being able to re-call the script when the window size changed or onorientationchange. So I exported main() to the window.
  • not adding the src="" value into the list of srcset="" values. It produced behavior that wasn't easily controlled.
  • not assuming that a bigger screen meant needing a bigger image. In my layouts, there were three targets: smartphone had the small image, tablet had the large image and desktop had the medium image.
  • when I resize down to smartphone, the smaller image was needed again, not the large one. This may have been poor design on my part as I wasn't using squishy images. Had I been, once the larger image was loaded, it could have squished down to the smaller size without issue.
  • I kept getting a bunch of errors in older IEs, thus the pedantic validation. Probably wasn't the best approach

Please merge in the functionality you deem appropriate. If you don't I may fork one eventually, but don't hold your breath.

@borismus
Copy link
Owner

Scott, can you elaborate on what unexpected behavior having both @src and @srcset resulted in?

Regarding resizing, see the discussion here: #17

I don't care about older IEs, but if you have a fix, please submit a PR.

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