Closed adampotocki closed 10 years ago
picture.js (in public/js/vendor or https://github.com/scottjehl/picturefill) responds to browser resize events. So it'll take care of changing the image when the user manually resizes the browser.
You can fire resize programmatically with
var event = new Event('resize');
elem.dispatchEvent(event);
Thank you I wanted to resize on the fly (i think it's pointless) I'd have to destroy current then reload new image...any graceful way of doing that?
On Wed, Jun 18, 2014 at 8:33 AM, Eddyystop notifications@github.com wrote:
picture.js (in public/js/vendor or https://github.com/scottjehl/picturefill) responds to browser resize events. So it'll take care of the user manually resizing the browser.
You can fire resize programmatically with
var event = new Event('resize'); elem.dispatchEvent(event);
— Reply to this email directly or view it on GitHub https://github.com/eddyystop/mithril-components/issues/1#issuecomment-46429272 .
picturefill replaces images itself e.g. picImg.src = bestCandidate.url;
so you'd be no worse off doing that yourself. The browser caches the images so performance should be fine.
function changeImg(el, path, file) {
el.src = path + file;
}
changeImg(document.getElementById('myImage'), '//http:.../', 'small.jpg');
gotcha thanks!
On Wed, Jun 18, 2014 at 11:51 AM, Eddyystop notifications@github.com wrote:
picturefill replaces images itself e.g. picImg.src = bestCandidate.url; so you'd be no worse off doing that yourself. The browser caches the images so performance should be fine.
function changeImg(el, path, file) { el.src = path + file; } changeImg(document.getElementById('myImage'), '//http:.../', 'small.jpg');
— Reply to this email directly or view it on GitHub https://github.com/eddyystop/mithril-components/issues/1#issuecomment-46454470 .
How would i go about firing an on resize event in order to make images responsive?