Nifty Way to Hover Over Images |
Nifty Way to Hover Over Images |
![]()
Post
#1
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Member Posts: 1,574 Joined: Aug 2007 Member No: 555,438 ![]() |
While studing a few websites I goto to see how they work I came accross a seamingly professional method to transitioning images while a user mouse is hovering over images. Slacker.com does it.
First, they created an image to represent both transitions for the image: ![]() Second, they created a style that would only show you the portion of the image they wanted you to see until you hover over it: CODE <style type="text/css"> #eGadsPB{ display:none; margin:0 0 0 4px; background:url(/images/egads/premium_upgrade.jpg) no-repeat; height:68px; width:647px;} #eGadsPB:hover{background-position:0 -68px;} #eGadsPB a img{height:68px; width:647px;} </style> Thrid, they applied that style to the image: CODE <div id="eGadsPB"><a href="/upsell/radio/" target="_Slacker"><img src="/images/s.gif" alt="Upgrade to Slacker Premium Radio"/></a></div> This method to doing a hover over effect is extremely effect because the user viewing your website only needs to download one image from the server in order to apply the transition. This also means that you won't have any jitter what-so-ever the first time a user connect to your site. I guess I'm just sharing this with you guys because I didn't know and I'm always looking for ways to optimize my code. I figure others are out there looking to do the same. Check the effect out at: http://www.slacker.com/ :) |
|
|
![]() ![]() |