-
Notifications
You must be signed in to change notification settings - Fork 223
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
Responsive background images #108
base: master
Are you sure you want to change the base?
Conversation
- replaceImagesBasedOnScreenDimensions -> updateElement - changeImageSrcToUseNewImageDimensions -> filterUrl - removed determineAppropriateResolution (getClosestValue does the job)
b327873
to
9e0f4d9
Compare
I implemented your changes and discovered a bit of a weakness: sometimes you want to use background images, but sometimes you want s. The site I'm dealing with uses thumbnail images which must all be the same size -- a perfect use case for background images. But I also needed to use full-size versions of these images and maintain their true aspect ratio. And it's much easier to just let the browser resize things than to do it with JavaScript. So, my solution is to have another data attribute: data-background. This would be set as "yes" when you want to use a background-image, "no" or not used at all when you want to use an . See http://kvdesign.net/testing for what I mean. Click on a project to see the modal with the thumbs. |
Well in that case the CSS Regarding your point, this is true that this PR does not consider each image individually (cf. Imager constructor, this is decided once for all). This is mostly influenced by DOM replacement/update which would be unnecessary complex (to me, but I am not everybody so feel free to challenge this opinion). Remember you can use several instances of Imager: one could be used to handle responsive images, another one could be used to handle background responsive images. |
I first tried using an Imager.update() method for the modals, passing Then I tried using a new instance of the Imager for each modal. But there was also a problem with using a new Imager instance for each So I settled on a single Imager instance, an update() method and using Rick On 11/27/2014 6:06 AM, Thomas Parisot wrote:
|
…hen replacing background image
Allow data-class attribute to be copied when replacing background image
@oncletom why was this never released? :'( any chance it still will? |
@nealoke good question – I probably missed it at some point. I am no longer a BBC employee so I do not have write permissions anymore. Happy to contribute again at some point if this library is still relevant in today's polyfilling world. |
@oncletom what other methods do you use now to solve the issues imager was created? I still see no way to effectively do this though :/ thanks! |
Hiya,
Not sure quite why I'm cc'd in this! But with it being in github and as
long as its' public, you can fork, make changes and submit a merge request.
Jodi.
…On 24 February 2017 at 15:36, Thomas Parisot ***@***.***> wrote:
@nealoke <https://github.com/nealoke> good question – I probably missed
it at some point.
I am no longer a BBC employee so I do not have write permissions anymore.
Happy to contribute again at some point if this library is still relevant
in today's polyfilling world.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#108 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADOeYptz9lMUX9KffL16o8RhEvg6eFe_ks5rfvjsgaJpZM4CzIQF>
.
|
Added a new option,
cssBackground
.When
cssBackground === true
, Imager updates theelement.style.backgroundImage
.When
cssBackground === false
(or is not set), Imager work as usual (div -> img[blank gif] -> img[src])closes #88