html - Changing DIV Background Image with JavaScript Not Working -
i'm trying change div background image on hover, want javescript works cross browser without issues. current code have is:
<div class="staff" style="background-image: url(/wp-content/uploads/2013/08/img_1828- 300x237.png);" onmouseover="this.style.background=url(wp-content/uploads/2013/08/img_1836-v2-300x237.png);" onmouseout="this.style.background=url(wp-content/uploads/2013/08/img_1828-300x237.png);"> </div>
css:
.staff{ width: 300px; height: 237px; }
can see causing problem?
<style> .staff{ width: 300px; height: 237px; background-image: url(/wp-content/uploads/2013/08/img_1828- 300x237.png); } .staff:hover { background-image: url(wp-content/uploads/2013/08/img_1836-v2-300x237.png); } </style> <div class="staff"></div>
Comments
Post a Comment