How to make ads responsive

I’m taking a bit of a guess, as my JS knowledge is in the formative stage, but it looks like your first piece of JavaScript is setting the image tags to a fixed pixel value for their width/height, but there’s no percentage values set in CSS to override those - setting a percentage value in CSS make the images fluid within their parent container.