I need to change the source of image if its width is less than 600px. I created following script but it is not working.
var sizewidth = window.innerWidth;
screensize();
function screensize() {
if (sizewidth < 601) {
document.getElementById('logotipo').src = "../imgs/image.png";
}
}
What is wrong in it? Can someone help me correct it?