Log In · Register

 
 
Closed TopicStart new topic
More Rollover troubles., sorry i keep posting about them.
lucasnotreally
post Jul 19 2009, 09:15 PM
Post #1


Creative Developer
****

Group: Member
Posts: 116
Joined: Jan 2009
Member No: 712,281



so i have figured out one way to do rollovers, where i have a class for each individual rollover then past it in the slice with a spacer over top, but the backgrounds take longer than desirable to load, and there is a black hover for a good 2 seconds before the image shows up.

i havent seen these on other layouts, and i dont know what the problem is.


here is the page i did: myspace.com/wearemissions

here is one i like that doesnt have the lag: myspace.com/lifeonrepeat

sorry again for posting so many questions about rollovers, im just trying to perfect them now so i dont have to keep working on them in the future.

thanks in advance =)

*****edit*****

here is the code im using http://www.createblog.com/forums/index.php...t&p=3217913 (the one in the post from mike)
 
Mikeplyts
post Jul 19 2009, 09:43 PM
Post #2


Mel Blanc was allergic to carrots.
*******

Group: Official Designer
Posts: 6,371
Joined: Aug 2008
Member No: 676,291



Well, what's the code you're using?


You can also try this method:

First, get your two images. Make a new document in your image editing software that's double the height of the image before rollover. Paste your image before rollover and position it in the top half. Then, take the image after rollover and paste it as well except position it on the bottom half. Now, save your image.

Next, add this code to your CSS:
CODE
<style>
.CLASS_NAME {display:block; width:###px; height:###px; background-image: url("IMAGE_URL"); background-repeat:no-repeat; background-position:top left;}
.CLASS_NAME:hover {display:block; width:###px; height:###px; background-image: url("IMAGE_URL"); background-repeat:no-repeat; background-position:bottom left;}
</style>

You can change CLASS_NAME to whatever you want you want to name your class. Put in the appropriate value for the width but for the height, since you have your image with both before and after on it with doubled height, then go ahead and put in half of the height in the height property so you can separate the image in half. The way the rollover works is since the image is separated in half, we use the background-position property to enable which half is shown so in this case, since your before rollover is on the top half of the image, we will use top-left for the value for the before rollover class (.CLASS_NAME) to display the top half and bottom-left for the value on the after rollover class (.CLASS_NAME:hover) to display the bottom half.

Now, add this to your HTML:
CODE
<div style="position:absolute; top:###px; _top:###px; left:50%; _left:50%; margin-left:-###px; _margin-left:-###px;">
<a class="CLASS_NAME" href="LINK_URL" target="_self">
</div>

Replace ### with the appropriate values, CLASS_NAME will be the same name for the class you defined in the CSS just without the period, and LINK_URL will be the URL to where you want to link to. You can change the target if you want, but I'll leave it as "_self" so that the link doesn't open in a new window/tab.

Now, save and you should be done! You can add more classes and div's if you want but you just have to repeat the codes I gave you with the appropriate classes. thumbsup.gif

Sorry if that was kind of confusing and long. :p
 
lucasnotreally
post Jul 19 2009, 10:31 PM
Post #3


Creative Developer
****

Group: Member
Posts: 116
Joined: Jan 2009
Member No: 712,281



i dont think thats the problem, because the profile i linked too that doesnt have a lag uses two images for the rollovers, not one with top and bottom.

and i tried to get their code, and it seems they added a class to all the links they wanted to be rollovers and then inside the slice had the two images instead of each rollover on its own class.

i just dont know how to do that.

 
Mikeplyts
post Jul 20 2009, 12:06 AM
Post #4


Mel Blanc was allergic to carrots.
*******

Group: Official Designer
Posts: 6,371
Joined: Aug 2008
Member No: 676,291



^well, it seems like it but it doesn't really take THAT long once you actually do it. After a few times, it's as easy as eating cheese. tongue.gif
 
Mikeplyts
post Jul 20 2009, 12:10 AM
Post #5


Mel Blanc was allergic to carrots.
*******

Group: Official Designer
Posts: 6,371
Joined: Aug 2008
Member No: 676,291



^Oh, well I don't think you have to use a DIV. I think all you have to do is replace the img tag in a slice in the table code with the a tag that I provided in that little div code. tongue.gif I'm not 100% certain though. :\
 

Closed TopicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members: