366 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Has been a member for 4-5 years
  • New Zealand
  • Referred between 10 and 49 users
  • Bought between 10 and 49 items
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
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
  • Author had a Free File of the Month
  • Bought between 10 and 49 items
  • Egypt
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
+1 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');
    });
});
3192 posts
  • Sold between 5 000 and 10 000 dollars
  • United States
  • Bought between 10 and 49 items
  • Has been a member for 4-5 years
  • Exclusive Author
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
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Has been a member for 4-5 years
  • New Zealand
  • Referred between 10 and 49 users
  • Bought between 10 and 49 items
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
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
  • Author had a File in an Envato Bundle
  • Bought between 1 and 9 items
  • Elite Author
  • Europe
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 100 and 199 users
+2 more
duotive says

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

by
by
by
by
by
by