I manage 15 websites for a specific client.
I received new photos (to be uploaded to the website) from the client last night.
Today. I received a message about the new responsive image feature.
This feature will break an exported site that uses JQuery to dynamically load images.
ie: a LightBox
This is the line of code it creates… notice the new “srcset” and “sizes” attributes.
This affects everyone using JQuery to dynamically populate images on a website.
So if you’ve built a LightBox feature in PHP/ JQuery… it will break.
So here’s the quick fix for this.
Simply wipe-out the srcset attribute.
In PHP - using the below example code:
$("#the-image").attr('src',$url_image); // this line changes the src of an ID to a whatever value is in $url_image
$("#the-image").attr('srcset',""); // add this code to wipe-out the srcset attribute
I also saw another new attributes (sizes)… which I haven’t played with yet.
It seems the webflow update uses src to load the image into place… but srcset to change the image depending on resolution.
The fix works… but then I lose the responsiveness of the images - I will need to adapt my code to dynamically update srcset as well.