6 replies [Last post]
blackice856
blackice856's picture
Offline
newbie
Last seen: 7 years 4 weeks ago
Timezone: GMT+1
Joined: 2013-07-04
Posts: 4
Points: 5

I'm coding something like a photo gallery, basically when you click on a thumbnail, a larger image will appear.

I used the checkbox hack to mimic an on click event, so when you click on the thumbnail1, you check the checkbox1 and the picture1 appears.

The problem is if I click on the thumbnail2, when I click at thumbnail1 the picture1 wont appear because picture2 its already there!

What I wanted to know is if it is possible, for example, when I check the checkbox1, automatically uncheck all the other checkboxes.

Thanks for your time (:

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 23 hours 41 min ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5343
Points: 2964

yes it is possible. Can you

yes it is possible.
Can you make it easier by showing what you have so far?

Have you thought of using radio buttons only one can be selected at a time.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 6 hours 21 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9761
Points: 3843

A javascript solution

You may be able to adapt this demo to your case.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

blackice856
blackice856's picture
Offline
newbie
Last seen: 7 years 4 weeks ago
Timezone: GMT+1
Joined: 2013-07-04
Posts: 4
Points: 5

Thanks for the

Thanks for the replys!

gary.turner - I know javascript would do the thing, I don't know why, but I kinda hate Javascript. There's also other ways to do it, but I really want to make it in CSS, don't ask me why, but Im facing it like a challenge x).

tony - Thanks for your tip, actually I didn't remembered that radio buttons work like that. I will be testing it as soon as possible (:

I will post the result for you when I'm done with it.

Cheers and once more, thanks Laughing out loud

blackice856
blackice856's picture
Offline
newbie
Last seen: 7 years 4 weeks ago
Timezone: GMT+1
Joined: 2013-07-04
Posts: 4
Points: 5

The thing with the radio

The thing with the radio buttons didn't worked out, as far as I learned from reading, if the radiobuttons don't have the same name, that will never work out Sad

The code is here: http://jsfiddle.net/blackice856/3vhCH/1/

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 6 hours 21 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9761
Points: 3843

They must have the same name,

They must have the same name, but may have different id attributes. That should provide for differentiation.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

blackice856
blackice856's picture
Offline
newbie
Last seen: 7 years 4 weeks ago
Timezone: GMT+1
Joined: 2013-07-04
Posts: 4
Points: 5

hmm sorry can you explain me

ahhhhh! Got I now! Searched more deeply about radio buttons, and they have name besides the id, it worked like a charm Laughing out loud thanks a lot!