Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9023195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:42:16+00:00 2026-06-16T05:42:16+00:00

I’ve already spent hours looking at as many online resources and stackoverflow questions as

  • 0

I’ve already spent hours looking at as many online resources and stackoverflow questions as I can find but for some reason I just can’t figure this out.

I’m attempting to use CSS and image sprites to make a link display as an image that changes once it is hovered over and once it has been clicked. I’ve played round with CSS and looked at JavaScript for far too long now and I just need some direction on how to get it working.

I’ve managed to make it change once its hovered over however what i really need to do is have the image change once it is clicked. So the begin with it displays the play button and when its clicked it displays a pause button, click it again and it displays the play button etc.

From what i can gather i will need to use JavaScript and an onclick event. However I’m not sure how this would work or how to use it with image sprites.

My CSS so far looks like this

.testclass .stratus {
background-position: -1px -1px;
width: 21px;
height: 21px;}
.

.testclass .stratus:hover {background-position: -1px -29px; width: 21px; height:
21px;}
.

However this only effects the play button and when it is hovered over. Now i need a way to display the pause button when the play button is clicked and vice versa.

Image sprites URL.
http://www.danceyrselfclean.com/wp-content/uploads/2012/12/sprites.png

URL of page im trying to get this to work on.
http://www.priceofmilk.co.uk/uncategorized/ddd-2

Can this be achieved using CSS and HTML or will I also need to use some JavaScript? Any assistance would be much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:42:17+00:00Added an answer on June 16, 2026 at 5:42 am

    I made a simple example. I use background colors and an anchor but you can easy implement this in your situation.

    update

    Updated the code so it uses your images.

    HTML

    <a class="play_pause">PLAY</a>​
    

    CSS

    .play_pause {
        display: block;
        width: 24px;
        height: 23px;
        text-indent: -99999px;
        background: url(http://www.danceyrselfclean.com/wp-content/uploads/2012/12/sprites.png); 
        cursor: pointer;
    }
    
    .playing {
        background-position: -27px 0; 
    }
    
    .playing:hover {
        background-position: -27px -28px !important; 
    }
    
    .play_pause:hover {
        background-position: 0 -28px; 
    }​
    

    And the JS:

    $(document).ready(function() {
        $(".play_pause").click(function() {
            $(this).toggleClass('playing');
        });
    });​​
    

    ​

    JsFiddle example

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I already spent hours on this problem, but I didn't succeed in finding a
I've spent a few hours already studying some CMS solutions for one of my
I'm trying to style an upload field, and I've already spent many hours trying
Spent hours but couldn't find what is the problem with the code. The code
First, I have already spent the past few hours trying to find a solution
I already spent hours on this problem, but I didn't succeed in finding a
I'v spent already a few hours to figure out this query but no result,
I hope someone can help me as I've already spent several hours trying to
I have a problem with php header redirect. I already spent hours trying to
I've looked through the various questions already asked on this topic, and I've spent

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.