Support » Plugins and Hacks » Hacks » Onclick>Visited>Image>Replace?

  • xiao_coffe


    I have searched in Google for an answer on how an image should be replaced when a user click on a image/link (and stay that way). Every user should click the link/image. So i think visited will be best!

    I’ve tried onclick example but it just goes back to the first picture again after refresh.

    Also tried a:visited on background-images and hide text link but image will not change.

    (I know how to get for exempal links turns green but not switch image)

    It is the only feature that I have left before my website is finished, so I must get it to work.

    is there any jquery code that can solve this, or is it possible with HTML and CSS?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Timothy Jacobs


    I would recommend posting your question at Stack Overflow.

    That being said, my initial thought would be to do away with the actual <img> tags, and use background-image properties for both a and a:visited.

    If, that doesn’t work, you would need to use cookies and set a cookie via jQuery when the link is clicked, and then switch out the <img> based on the value of the cookie that you set.



    Thanks for the reply.

    I’ve tried lots of different a and a: visited, but with no good results. but it
    are certainly several variants of this.

    One of my examples:

        <img src=”image.jpg” width=”240px” height=”240px”/>
    </ a>

    a.mylink {
         width: 120px;
         height: 240px;
         display: block;
         overflow: hidden;


    I think that the other answar is something that I can use, do you have any ideas? or any related links?

    Regards: xiao_coffe

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Onclick>Visited>Image>Replace?’ is closed to new replies.