Hello i’m newbie i have found a script that display marker on google map with infowindow that show image
you can check demo here:
i want make image linkable
for example <a href="example.com"><img src="https://www.iconexperience.com/_img/v_collection_png/256x256/shadow/bird.png"></a>
Can you show how to modify script?
any help?
thanks
remove line 46, where you append the image to the window.
remove line 51, where you put the name in the text link (unless you want that as well as the image)
add a line after 51:
text.appendChild(imageEl);
so you add your previously-created image element to the new link element, not to the window directly.
That bit of code looks like:
var imageEl = document.createElement('img');
imageEl.src=image;
imageEl.alt='altimg'
//infowincontent.appendChild(imageEl); <- commented this out
infowincontent.appendChild(document.createElement('br'));
var text = document.createElement('a');
text.href=url;
text.target='_blank'
//text.textContent = name; <- commented this out
text.appendChild(imageEl); <- added this
infowincontent.appendChild(text);