Any advice would be much appreciated, I’m sure this is simple for some of you web wizards. Thank you very much for your time.
I have some css that is working to change the revealed portion of .png when a user hovers over it:
.small_icons ul li.companyButton .circle {background-position:0 0;}
.small_icons ul li.companyButton:hover .circle {background-position:0 -56px;}
I’d like to then keep the position at 0 -56px when the user clicks on the image and switch back to 0 0 when the user clicks on a different image. This is all happening on the same page so I imagine I have to use a javascript onclick function.
I can’t seem to figure out how to access that specific css element using javascript. I’ve tried:
document.getElementByClass("circle").style.background-position:0 -56px;
but that doesn’t change anything. Is it because .circle is a child class of .companyButton which is a child class of .small_icons?
Many thanks!
You messed with type
document.getElementsByClass("circle")isNodelist(object like array). so you should loop through it, or useto loop through you need
more about dinamyc styling