briefcasecat — 2010-02-17T21:46:33-05:00 — #1
I am new here (but have sitepoint books), so hope that this the right place to come with begging bowl ready for info.
So... using CSS what is the most reliable way to display an image on hover. It's not straight forward tho. I need to hover on a small image, get it to display a different image larger and center that larger image. And I need to do it 16 times on the same page. It's an image gallery and the small images are crops of artwork and I need the whole artwork shown on hover.
I dont have a link because I am still trying to work it out.
My head hurts from it too. :goof:
ralphm — 2010-02-17T23:10:09-05:00 — #2
Hi briefcasecat, Welcome to SitePoint!
Here is a nice CSS only example, courtesy of EricWatson who frequents these fora:
briefcasecat — 2010-02-18T07:05:57-05:00 — #3
Thanks Ralph - I have looked at that source code and will have a play with it tomorrow. It was kind of you to answer so quickly. Where should I have posted that btw - I am sure I will have more css questions in the very near future.:rolleyes:
briefcasecat — 2010-02-18T07:15:00-05:00 — #4
Sorry - I just figured out where the question should have been posted. B'ah - newsters, eh? Thanks again.
ralphm — 2010-02-18T07:38:00-05:00 — #5
Yes, sorry, I should have provided the link. There has actually been some discussion lately about whether or not the various fora are arranged in the best way, so don't feel bad. There's a lot to find and explore here.
Hopefully we'll see you here again soon! Good luck with the coding.
briefcasecat — 2010-02-18T18:44:59-05:00 — #6
Okay ... I have played with Eric's code and his final result looks lovely. My looks like ants on the page and when you hover over them they show a large image. Anyone know how to make the sizes right? I tried giving the class dimensions for display and I tried (and then took out) and then the small image shows as a grey block (the b/g colour is the drop shadow I think) and no image. How can I stuff up code that I just copied. Hmmm... I'd like to think that this happens to people all the time.
briefcasecat — 2010-02-18T18:46:20-05:00 — #7
The web address will come along in a minute - I have to make 5 posts to be able to post one.
briefcasecat — 2010-02-18T18:49:00-05:00 — #8
ralphm — 2010-02-18T19:08:36-05:00 — #9
Hmm, are you using super-large images? I couldn't get the page to load. I'll try again later.
ralphm — 2010-02-18T19:17:44-05:00 — #10
Sorry, page is loading fine now. I'll take a look.
briefcasecat — 2010-02-18T19:22:18-05:00 — #11
Hi there Ralph M. Images are small. Thmubs are 47k and big images are 900k (because they're artworks and need people to see them). Playing round a little more, as opposed to ants, I've got boxes now (in some random order-I need them in rows which will come later) and I see the larger images on hover. But the thumbs are just showing as boxes. Grey, grey boxes..
ralphm — 2010-02-18T20:32:00-05:00 — #12
900kb for the large images is a bit too big, in my view. You'll get good image quality even at 80kb and lower, which would be better.
As for the thumbnails not appearing, first check to make sure your file paths are correct. Where are the images stored in relation to your root folder?
Sorry I haven't been more helpful. Lots of work on today, I'm afraid, but there may be more time tonight.
briefcasecat — 2010-02-18T22:16:35-05:00 — #13
Hi again - I have taken your advice, make images smaller, and redone my file structure. Put it up somewhere else too.
So it's getting there but would you go about styling this? The thumbs were stillallover teh place, so I put them in a table (against the law formerly but sitePoint's IE 8 books now tells me to use tables) but no luck so I have put them in a list. With float left & margins. No luck. I am thinking individual divs (aka divitis). What would you do? Thanks so much again.
ralphm — 2010-02-19T08:21:22-05:00 — #14
I think the main problem here is that the gallery, as it stands, is really designed such that all the thumbnails have the same dimensions and the large images are also the same size. That's not the case for you, hence the layout problems (as well as not having the same number of images as in the original).
I'm currently working on a Gallery for a calligrapher, based on this model. If you'd like a gallery like this, let me know and I'll tell you how to set it up (if it's not obvious).
PS The gallery I'm working on is here, in case you're innerested.
picnictutorials — 2010-02-19T09:05:34-05:00 — #15
Hello, Looks like you got to pull out your calculator and do so math. Nothing adds up. Sketch it out in your head (or paper). Add up the thumb size, borders, margins, padding, large pics, etc, and then piece it together. Get rid of the tables, and float all the thumbs left (or whatever I did in mine)
In my example all my thumbs are the same size. This is for aesthetics and ease of my math skills. If all your thumbs are dif size then you might want to do display inline-block on all the thumbs instead. What ever works...
paulob — 2010-02-19T09:20:58-05:00 — #16
Eric you have a bug on this page
in Firefox and the thumbs all break out of the container when hovered due to the border increasing the size. You may want to fix that
ralphm — 2010-02-19T09:43:12-05:00 — #17
Huh, it works fine in Firefox for me. :shifty:
picnictutorials — 2010-02-19T10:02:04-05:00 — #18
Works fine for me too on fx 3.5.7. If it's broke in whatever fx then it's fx's fault because all the math is correct.
paulob — 2010-02-19T10:41:14-05:00 — #19
Sorry Eric it seems to be me
I've never noticed this before in Firefox but when I paste your link into a tab it loads the page but at a zoomed size even if the tab wasn't zoomed. It seems that at some time I must have increased the zoom size accidentally and when I load that page it always loads it at the zoom size I was using.
I just tried it on other tabs and it seems to remember the zoom size you were last using on that url. Indeed if you have 3 tabs open with the same url it enlarges all of them!
Not a feature I like or find useful but I suppose for users who always want a site at a certain text size it would save them having to adjust it.
Apologies for the confusion as the page is only broken on zoom
picnictutorials — 2010-02-19T11:00:08-05:00 — #20
No prob Paul :~) Yeah a while back I found out too. As you said, FX will remember and apply your previous zoom setting for each site you visit.
next page →