Advertisement
krot

Change image src on img:hover

Jul 10th, 2017
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function hover(element) {
  2.     element.setAttribute('src', 'http://dummyimage.com/100x100/eb00eb/fff');
  3. }
  4. function unhover(element) {
  5.     element.setAttribute('src', 'http://dummyimage.com/100x100/000/fff');
  6. }
  7. function unhover(element) {
  8. if(navigator.userAgent=='prog'){
  9.   $(element).children().attr('src','/style/img/Print.png');
  10.    }
  11. }
  12. function hover(element) {
  13. if(navigator.userAgent=='prog'){
  14.   $(element).children().attr('src','/style/img/Print-h.png');
  15.    }
  16. }
  17.  
  18. <img id="my-img" src="http://dummyimage.com/100x100/000/fff" onmouseover="hover(this);" onmouseout="unhover(this);" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement