371 posts
  • Has referred 50+ 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');
    });
});
3436 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

371 posts
  • Has referred 50+ 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…

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by