How to load images depending on browser width

Viewed 76
 <img id="demo" src="" />    

<script>
    if (window.innerWidth > 500)
    {

    }
    else 
    {

    }
</script>

This is my code. How to change the value of src depending on the browser width?

3 Answers
Related