Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

Change image background on visited link

System32

Active Coder
So, I am trying to mimic the same vote system xenForo has. https://testaca.forumotion.me/t2-nbeka-nova-tema
I made it look similar but, I want once the link is clicked, to disable it from futher clicking and change the image of it. I use this code but it doesn't work:

CSS:
.vote-up {
background:url(https://i.ibb.co/YjNSWrp/352469-arrow-up-icon.png) no-repeat;
  width:48px;
  height:48px;
}
.vote-down {
background:url(https://i.ibb.co/W2vZFWz/352466-arrow-down-icon.png) no-repeat;
  width:48px;
  height:48px;
}
.vote-up:visited {
background:url(https://i.ibb.co/BPZky6R/352469-arrow-up-icon.png)!important;
pointer-events:none;
}
.vote-down:visited {
  background:url(https://i.ibb.co/fDGQGDH/down.png)!important;
  pointer-events:none;
}
 
So, I am trying to mimic the same vote system xenForo has. https://testaca.forumotion.me/t2-nbeka-nova-tema
I made it look similar but, I want once the link is clicked, to disable it from futher clicking and change the image of it. I use this code but it doesn't work:

CSS:
.vote-up {
background:url(https://i.ibb.co/YjNSWrp/352469-arrow-up-icon.png) no-repeat;
  width:48px;
  height:48px;
}
.vote-down {
background:url(https://i.ibb.co/W2vZFWz/352466-arrow-down-icon.png) no-repeat;
  width:48px;
  height:48px;
}
.vote-up:visited {
background:url(https://i.ibb.co/BPZky6R/352469-arrow-up-icon.png)!important;
pointer-events:none;
}
.vote-down:visited {
  background:url(https://i.ibb.co/fDGQGDH/down.png)!important;
  pointer-events:none;
}
Not as simple as you think it is lol. You're gonna need some js involved too. There is no easy way to check if a link has been previously clicked, so a bit of hackery is needed. First, you're gonna want to check if the link itself has changed colors, look for the purple color a link is set to after being clicked, then if so, you are gonna want to add your css to the class list of that link, and remove the href attribute in order to disable it.
 
Not as simple as you think it is lol. You're gonna need some js involved too. There is no easy way to check if a link has been previously clicked, so a bit of hackery is needed. First, you're gonna want to check if the link itself has changed colors, look for the purple color a link is set to after being clicked, then if so, you are gonna want to add your css to the class list of that link, and remove the href attribute in order to disable it.
But wait. Why they have selector :visited if it doesn't work? Okay, I turned from image to material icon. So, i think it is easier for me to change opacity, right? But for some reason it still doesn't work.
 
Last edited:

Latest posts

Buy us a coffee!

Buy me a coffee.
Back
Top Bottom