dsinghldh Posted January 14, 2008 Share Posted January 14, 2008 Hi all Iam developing a site where lots of small images are shown on home page,I want that whenever someone places a mouse(onmouseover event) on small images they get bigger in size.Can anyone share code with me. Iam coding in PHP Thanks Quote Link to comment https://forums.phpfreaks.com/topic/85929-onmouseover/ Share on other sites More sharing options...
phpQuestioner Posted January 14, 2008 Share Posted January 14, 2008 <style type="text/css"> .mysmallpic { width:50px; height:50px; } .mybigpic { width:500px; height:400px; } </style> <script language="javascript"> function enlarge(pic) { document.getElementById(pic).className="mybigpic"; } function normal(pic) { document.getElementById(pic).className="mysmallpic"; } </script> <img id="pic1" class="mysmallpic" src="" onmouseover="enlarge(this.id)" onmouseout="normal(this.id)"> Quote Link to comment https://forums.phpfreaks.com/topic/85929-onmouseover/#findComment-438719 Share on other sites More sharing options...
redbullmarky Posted January 14, 2008 Share Posted January 14, 2008 Hello and welcome to the forums. Please make yourself familiar with the forum guidelines, and carefully read the board descriptions BEFORE posting a new topic. @phpfreaks is for questions regarding this site, not your own issues. as for your question, it has nothing to do with PHP as it's a client-side issue. you can probably achieve it with pure CSS as an alternative to the Javascript one suggested by phpQuestioner. .image { width:75px; height:75px; } .image:hover { width:120px; height:120px; } although (not sure if still the case) i believe some browsers don't like :hover on anything other than regular links. some CSS-only tricks dealing with this sort of things can be found here: http://www.cssplay.co.uk Quote Link to comment https://forums.phpfreaks.com/topic/85929-onmouseover/#findComment-438762 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.