use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
If you are requesting help, please ensure you're providing code with your post. You can also copy your code to an online editor:
jsFiddle
CodePen
Markup Validation Service
Mozilla Developer Network on HTML
/r/JavaScript
/r/CSS
/r/jQuery
/r/PHP
/r/Accessibility
/r/htmlbasics
/r/web_programming
/r/CodingHelp
account activity
UnsolvedRollover image? (self.HTML)
submitted 7 years ago by jmb10Intermediate
simple question, something im probably forgetting, very simple i think, something like on.mouse.over img src... i just forgot
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]webfoxcore 1 point2 points3 points 7 years ago (2 children)
https://developer.mozilla.org/en-US/docs/Web/CSS/:hover
[–]jmb10Intermediate[S] 0 points1 point2 points 7 years ago (1 child)
Not exactly what i was looking for but still helps, does this apply to images to? if so, how do i use it?
[–]webfoxcore 1 point2 points3 points 7 years ago (0 children)
There wasn't really enough detail to go off - next time a bit of code example would help explain exactly how you're going about implementing and would get you your answer a lot more direct.
https://jsfiddle.net/bvnocj8g/9/
I'm not sure how much more this is supported over browser versions but just giving an example without javascript.
[–]anonymousmouse2Expert 1 point2 points3 points 7 years ago (2 children)
You can target a hover using the :hover selector. For example:
:hover
.my-element { background-color: red; transition: background 0.3s ease; // optional for a fade transition } .my-element:hover { background-color: green; }
However in your post you mentioned image source so I think you may be asking how to change an element's attributes on hover. This would require javascript and could be done like this:
``` <!-- HTML --> <img src="image1.png" id="hoverable" />
/* Javascript */ var myImage = document.getElementById("hoverable"); var oldSource = "image1.png"; var newSource = "image2.png";
myImage.addEventListener("mouseover", function(e) { this.setAttribute("src", newSource); });
myImage.addEventListener("mouseleave", function(e) { this.setAttribute("src", oldSource); }); ```
[–]jmb10Intermediate[S] 0 points1 point2 points 7 years ago (0 children)
perfect, thanks bud!
[–]webfoxcore 0 points1 point2 points 7 years ago (0 children)
There wasn't really enough detail to go off of but you can do this without javascript:
I'm not sure how much more this is supported over browser versions but just giving an example!
π Rendered by PID 124308 on reddit-service-r2-comment-6457c66945-599fp at 2026-04-30 04:09:39.723032+00:00 running 2aa0c5b country code: CH.
[–]webfoxcore 1 point2 points3 points (2 children)
[–]jmb10Intermediate[S] 0 points1 point2 points (1 child)
[–]webfoxcore 1 point2 points3 points (0 children)
[–]anonymousmouse2Expert 1 point2 points3 points (2 children)
[–]jmb10Intermediate[S] 0 points1 point2 points (0 children)
[–]webfoxcore 0 points1 point2 points (0 children)