366 posts
    Has referred 10+ members Has sold $125,000+ on Envato Market Has collected 10+ items on Envato Market Elite Author: Sold more than $75,000 on Envato Market
+5 more
PixelStores says

Hey,

I have a list in HTML and some CSS that displays images, the images use one image and simply changes the background position for the hover state.

I want to know if when a user clicks one of the list items the hover state would be set to selected.

I know in form fields you can set the focus, can this be done with a list of links that are images with HTML and CSS .

Perhaps some jquery is involved, some direction would be grateful. :)

Thanks.

1012 posts
    Has been part of the Envato Community for over 4 years Has referred 10+ members Has sold $10,000+ on Envato Market Has collected 10+ items on Envato Market
+6 more
wizylabs says

Hi Matt,

I don’t really understand what you exactly want but I wrote a simple script that adds a ‘selected’ class to the list item when you click on it and remove it from others that had it before.

$('ul li').each(function(){
    $(this).click(function(){
        $('ul li').removeClass('selected');
        $(this).addClass('selected');
    });
});
3220 posts
    Has sold $5,000+ on Envato Market Has collected 10+ items on Envato Market Located in United States Has been part of the Envato Community for over 4 years
+1 more
organicbee says
Hey,

I have a list in HTML and some CSS that displays images, the images use one image and simply changes the background position for the hover state.

I want to know if when a user clicks one of the list items the hover state would be set to selected.

I know in form fields you can set the focus, can this be done with a list of links that are images with HTML and CSS .

Perhaps some jquery is involved, some direction would be grateful. :)

Thanks.

maybe something like this Click

366 posts
    Has referred 10+ members Has sold $125,000+ on Envato Market Has collected 10+ items on Envato Market Elite Author: Sold more than $75,000 on Envato Market
+5 more
PixelStores says

Yep, sorry guys a bit hard to explain.

I’m using this code, the one with the hover state:

http://www.noobcube.com/wp-content/uploads/demos/073109-cssimagemaps/demo/

What i’m trying to accomplish is when a user clicks on the certain part of the map, the continent stays highlighted.

Any ideas? :)

3007 posts
    Has been part of the Envato Community for over 4 years Has referred 200+ members Has sold $250,000+ on Envato Market Had an item featured in an Envato Bundle
+7 more
duotive says

only javascript…. no css solution exists in my mind…. onclick set class active…

by
by
by
by
by
by