-
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
Image width getter attribute #81
base: master
Are you sure you want to change the base?
Conversation
The width is determined by the container width. This idea is pretty nice although I don't favour adding callbacks everywhere, adding extra overhead for something which can already be mastered through CSS. Is this something you can't achieve through CSS? |
@nkp do you have an input on my previous questions, about the feasibility in CSS? Thanks :-) |
Regarding the state of #86, is it working in the case of your carousel? |
Hello @nkp, just a quick nudge on this regarding my questions. Thanks :-) |
Hello looking back at your proposal, I am still not convinced your needs requires an extra feature. You could achieve that through the var imgr = new Imager({ availableWidths: stickToCarouselWidth('#my-carousel') });
function stickToCarouselWidth(elementSelector){
var carouselWidth = document.querySelector(elementSelector).width;
return function getImageWidth(image){
return carouselWidth;
};
} |
For lack of a better name, adds a 'getter' for interpreting an image's width for determining the appropriate resolution in a way other than 'clientWidth'.
Why?
This is useful for when one wants the responsive size to be dependent on something other than the image's present size.
To use an image carousel as an example:
Why not?
This functionality can be achieved by hot-swapping Imager.determineAppropriateResolution at runtime.