|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Mar 2003
Location: UK
Posts: 246
|
Preloading (CSS) rollover images
page
I have created the navigation on this page using the modified CSS list method (so the 'buttons' are always proportional, with the title centred above the image). All the rollovers etc work fine, except that now that it's on the webserver instead of the local machine there is a delay (while it load's the image 'hover' states image) the first time you mouse over each item. Is there anyway I could 'preload' the CSS background images, in the same way you do when you use a regular rollover? |
|
|
|
|
|
#2 |
|
SitePoint Guru
![]() ![]() ![]() ![]() ![]() Join Date: Dec 2002
Location: Switzerland
Posts: 738
|
maybe you could put an image pointing to the mouseover jpg/gif and set its display to "none" somewhere on your page.
Haven't tested it so i can't promise it'll work, only intuitively i would say it should work. <img src="yourhovergif.gif" style="display:none;" alt="" /> Of course it's a hack, don't know if you can do something cleaner .Quentin
__________________
The largest message boards on the web ! Targeted text ads - Link exchanges unblog.fr, hosting 130000 french blogs |
|
|
|
|
|
#3 |
|
SitePoint Zealot
![]() ![]() Join Date: Aug 2003
Location: Sydney
Posts: 194
|
Yeh ive heard that way works.
No need for JS then. |
|
|
|
|
|
#4 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Mar 2003
Location: UK
Posts: 246
|
If I put the images with the class="hidden" (I created a special class in the CSS file) in the list, it even displays ok with the css switched off.
It's not 'clean' but it works, thanks. |
|
|
|
|
|
#5 |
|
CSS Advisor
![]() ![]() ![]() ![]() Join Date: Jan 2003
Location: Hampshire UK
Posts: 29,298
|
|
|
|
|
|
|
#6 | |
|
Object Not Found
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Mar 2002
Location: northern MI
Posts: 1,384
|
Internet Explorer will not cache background images
This is an interesting problem. It could possibly save many a website from using javascript rollovers for images.
Several people have tried to change background-image with CSS without getting the 'flicker' that occurs in IE. It seems that IE is not able to cache background images. There's been a few solutions tried to solve this. One is to move the background-image, so that another part is shown on hover. Another example of the same idea. But, evidentally, IE still needs to load the background image again, even if it's just to move it. Quote:
I'd love to see this solved, big reps for anyone with a solution ![]()
__________________
Follow Me Dreamweaver Forum - GroovyJava GamesCSS Image Replacement ~ DoMedia ~ CSS Shorthands ~ Tenurgy ~ IFRS |
|
|
|
|
|
|
#7 | |
|
CSS Advisor
![]() ![]() ![]() ![]() Join Date: Jan 2003
Location: Hampshire UK
Posts: 29,298
|
Quote:
I've used techniques similar to doug's which work without flicker in IE6 and Mozilla. You put the image in the background of the div (effectively the rollover state) and then just put an image link in the foreground. On hover set the image to visibility:hidden which shows the underlying image. Code:
<style type="text/css">
<!--
.outer {
height: 60px;
width: 60px;
background-image: url(image1.gif);
}
.outer {display:block; }
.outer img {width: 100%; height: 100%; border: 0; }
html>body .outer img{display:block}
.outer a:hover{visibility:visible}
.outer a:hover img {visibility:hidden}
-->
</style>
Code:
<div class="outer"><a href="#"><img src="image2.gif" /></a></div> <div class="outer"><a href="#"><img src="image3.gif" /></a></div> <div class="outer"><a href="#"><img src="image4.gif" /></a></div> Paul |
|
|
|
|
|
|
#8 | ||
|
Object Not Found
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Mar 2002
Location: northern MI
Posts: 1,384
|
Quote:
Quote:
__________________
Follow Me Dreamweaver Forum - GroovyJava GamesCSS Image Replacement ~ DoMedia ~ CSS Shorthands ~ Tenurgy ~ IFRS |
||
|
|
|
|
|
#9 |
|
chown linux:users\ /world
![]() ![]() Join Date: Aug 2000
Location: Houston, TX, USA
Posts: 6,333
|
mediaman_12,
Just so you know, the page you listed does not display in Mozilla Firebird correctly. The top section is skewed and takes up most of the page.
__________________
ssegraves [at] gmail.com Boycott BP, Or Not - A Lesson in Distribution stephan | XMLHttpRequest Basics flickr | last.fm | Cogentas, LLC |
|
|
|
|
|
#10 | |
|
CSS Advisor
![]() ![]() ![]() ![]() Join Date: Jan 2003
Location: Hampshire UK
Posts: 29,298
|
Hi junjun,
Quote:
http://www.pmob.co.uk/temp/cssrollover.htm It seems to work ok in MOzilla and Ie6 (but still flickers a bit in Opera, I'll have to see if there's a fix) Paul |
|
|
|
|
|
|
#11 |
|
Object Not Found
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Mar 2002
Location: northern MI
Posts: 1,384
|
Paul,
yes that actually works perfect in IE6 and Moz1.5a. In Opera 7 it gives me a *constant* flicker when the mouse is *moving* on the image ![]()
__________________
Follow Me Dreamweaver Forum - GroovyJava GamesCSS Image Replacement ~ DoMedia ~ CSS Shorthands ~ Tenurgy ~ IFRS |
|
|
|
|
|
#12 | |
|
SitePoint Guru
![]() ![]() ![]() ![]() ![]() Join Date: Dec 2002
Location: Switzerland
Posts: 738
|
Quote:
Quentin
__________________
The largest message boards on the web ! Targeted text ads - Link exchanges unblog.fr, hosting 130000 french blogs |
|
|
|
|
|
|
#13 |
|
runat="server"
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2001
Location: Colorado
Posts: 2,077
|
I would love to see a solution to the flicker problem. Also the solution should have text + a graphic background.
I have played with this for awhile and couldn't find a solution. You can see my attemps here: www.search-this.com
__________________
WordPress Plugins: Comment Info Tip My Blogs: What a Savage | Search-This Tools: Search Engine Decoder | PageRank Decoder Podcast: Rand Fishkin | SitePoint Founders |
|
|
|
|
|
#14 |
|
CSS Advisor
![]() ![]() ![]() ![]() Join Date: Jan 2003
Location: Hampshire UK
Posts: 29,298
|
Hi junjun,
Try this for Opera7 as well: http://www.pmob.co.uk/temp/cssrollover2.htm Should work in Ie6, mozilla 1.2+ & Opera7 (without flicker) with any luck. Paul |
|
|
|
|
|
#15 |
|
runat="server"
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2001
Location: Colorado
Posts: 2,077
|
Paul, that's not a big enough sample size to really test it. Mine works too....sometimes...
You need to create a navigation on mulitiple pages and move between the pages to really test it. + get some text in there instead of just graphics
__________________
WordPress Plugins: Comment Info Tip My Blogs: What a Savage | Search-This Tools: Search Engine Decoder | PageRank Decoder Podcast: Rand Fishkin | SitePoint Founders |
|
|
|
|
|
#16 |
|
runat="server"
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2001
Location: Colorado
Posts: 2,077
|
actually you can see mine get jacked best this way:
open www.search-this.com then open another browser and move the one browser on top of my site and move your mouse back over my links. FLICKER!!!
__________________
WordPress Plugins: Comment Info Tip My Blogs: What a Savage | Search-This Tools: Search Engine Decoder | PageRank Decoder Podcast: Rand Fishkin | SitePoint Founders |
|
|
|
|
|
#17 |
|
Object Not Found
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Mar 2002
Location: northern MI
Posts: 1,384
|
Paul,
Works *great* in my browser! This will be really useful for *anyone* using javascript to do mouseover effects on buttons. Great job! ![]() ![]() ![]() Golgotha, 'sometimes' is not a very valid argument :-) Test Paul code, and I'm sure you'll be happy, your navigation buttons are all images anyway. ot: your search engine decoder is a really helpful tool. Your site is bookmarked.
__________________
Follow Me Dreamweaver Forum - GroovyJava GamesCSS Image Replacement ~ DoMedia ~ CSS Shorthands ~ Tenurgy ~ IFRS |
|
|
|
|
|
#18 | |
|
runat="server"
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2001
Location: Colorado
Posts: 2,077
|
Quote:
__________________
WordPress Plugins: Comment Info Tip My Blogs: What a Savage | Search-This Tools: Search Engine Decoder | PageRank Decoder Podcast: Rand Fishkin | SitePoint Founders |
|
|
|
|
|
|
#19 | |
|
Object Not Found
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Mar 2002
Location: northern MI
Posts: 1,384
|
Quote:
__________________
Follow Me Dreamweaver Forum - GroovyJava GamesCSS Image Replacement ~ DoMedia ~ CSS Shorthands ~ Tenurgy ~ IFRS |
|
|
|
|
|
|
#20 |
|
runat="server"
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2001
Location: Colorado
Posts: 2,077
|
Yeah, my solution works good for rollovers that are still SE friendly, but it still has its problems. I will explore Pauls ideas more later when I get home and If I come up with anything I will share.
__________________
WordPress Plugins: Comment Info Tip My Blogs: What a Savage | Search-This Tools: Search Engine Decoder | PageRank Decoder Podcast: Rand Fishkin | SitePoint Founders |
|
|
|
|
|
#21 |
|
CSS Advisor
![]() ![]() ![]() ![]() Join Date: Jan 2003
Location: Hampshire UK
Posts: 29,298
|
Hi,
I suppose something like this might work for text link rollovers. http://www.pmob.co.uk/temp/cssrollover3.htm The background is just set to transparent on rollover. As Golgotha said it needs testing on a page with more rollovers. It seems to work ok in IE6, moz1.2+ and Opera7. Paul |
|
|
|
|
|
#22 |
|
Object Not Found
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Mar 2002
Location: northern MI
Posts: 1,384
|
I'm guessing that what Golgatha and I are trying to figure out, is how to get something like this work without flikker:
http://www.domedia.org/oveklykken/cs...over-image.php
__________________
Follow Me Dreamweaver Forum - GroovyJava GamesCSS Image Replacement ~ DoMedia ~ CSS Shorthands ~ Tenurgy ~ IFRS |
|
|
|
|
|
#23 | |
|
CSS Advisor
![]() ![]() ![]() ![]() Join Date: Jan 2003
Location: Hampshire UK
Posts: 29,298
|
Hi,
Quote:
http://www.pmob.co.uk/temp/cssrollover4.htm Paul
Edit: Here's an updated example of the previous image only rollovers: http://www.pmob.co.uk/temp/cssrollover5.htm They seem to work without flicker (only tested in Ie6 , moz1.2+ and Opera7) Last edited by Paul O'B; Sep 30, 2003 at 15:06.. |
|
|
|
|
|
|
#24 | |
|
Object Not Found
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Mar 2002
Location: northern MI
Posts: 1,384
|
Quote:
![]() I spent numerous hours surfing last week, from blog to blog, from one CSS guru to the other, and noone was able to do this. They all had solutions that more or less flickered. You should put some comments on that page and let the world know asap ![]() ![]()
__________________
Follow Me Dreamweaver Forum - GroovyJava GamesCSS Image Replacement ~ DoMedia ~ CSS Shorthands ~ Tenurgy ~ IFRS |
|
|
|
|
|
|
#25 |
|
runat="server"
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2001
Location: Colorado
Posts: 2,077
|
ok, now if you can move that text over about 30pixels to the right, using padding or margin and have it also cross browser friendly I will kiss you.
really no flicker!!! cant wait to get home ![]()
__________________
WordPress Plugins: Comment Info Tip My Blogs: What a Savage | Search-This Tools: Search Engine Decoder | PageRank Decoder Podcast: Rand Fishkin | SitePoint Founders |
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 21:16.






.











Linear Mode
