Rollover image — Change image on hover/mouse over

Muhammad Jawaid Shamshad
Ibexoft
Published in
1 min readFeb 14, 2018

Often when designing websites static or dynamic, PHP or ASP.Net, Laravel or WordPress, you have to design in a way if user hovers an image it gets changed and an alternate image is displayed. This can be easily achieved via simple HTML events. Here is the trick:

<img src="FIRST IMAGE URL GOES HERE"
onmouseover="this.src='SECOND IMAGE URL GOES HERE'"
onmouseout="this.src='FIRST IMAGE URL GOES HERE - AGAIN'" />

It is simple as that.

Originally published at J Talk’s

--

--

Muhammad Jawaid Shamshad
Ibexoft

I'm a passionate software developer with a love for web technologies. Join me on this journey as we explore the fascinating world of software development.