strues / retinajs

JavaScript, SCSS, Sass, Less, and Stylus helpers for rendering high-resolution image variants
http://retinajs.com
MIT License
4.42k stars 611 forks source link

Refresh retinajs after img src changed #279

Open Honza-B opened 7 years ago

Honza-B commented 7 years ago

Hi, thanks for great plugin!

But I have a little issue with refreshing retinajs on image which has source image changed.

In event handler I have tried refresh retinajs this way:

slider.bind("slide.onafterswaped", function(e) {
    retinajs( $(e.target).find('img') ); 
});

Thanks for help!

helenburns commented 4 years ago

Is it possible for someone to comment on this please? I'm changing the src of an img tag dynamically with jquery but the new image is then fuzzy, calling window.retinajs(); doesn't help:

Original image in html:

<img src='./img/forward_dark.png' data-rjs='3' width='45' height='56' class='add_operation_next'/>

Code to change the src and make the image clear again:

$('.add_operation_next').attr('src', './img/forward_dark.png');
window.retinajs();

I've tried defining the image size in html, css and both. What am I missing?