I have a jquery statement that replaces an image based on screen size
It only works on refresh though. I want it to automatically run when the user resizes their screen past my set of parameters.
I can't figure out how to do this.
JQUERY
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
var screenWidth = $(window).width();
if ((screenWidth) < 769) {
$("#logoHolder img").attr("src" , "images/payday_ira_logo_stacked_web.png")
} else {
$("#logoHolder img").attr("src", "images/payday_logo_long_web.png")
}
});
html
<div class="d3-d4 m1" id="logoHolder">
<img src="images/payday_logo_long_web.png" alt="Pay Day IRA" />
</div>