Hello, I'm currently working on implementing the Product Categories menu on this specific page:
Currently, when the page loads, the CSS hover effect works correctly to display a rollover effect. However, I attempted to use JavaScript to set the background position on click, which unfortunately interfered with the CSS hover functionality.
The code snippet I used was: onclick="setStyle('c1','backgroundPosition','0px 0px');
After adding this JavaScript, the c1:hover no longer functions as expected. I tried using !important in the CSS for c1:hover background position and it solved the issue in Firefox but not in Internet Explorer.
My question is, how can I write a JavaScript function that also accomplishes this task:
onclick="setStyle('c1:hover','backgroundPosition','-276px 0px');
I understand that JavaScript does not recognize hyphens and typically requires camel case such as "backgroundPosition" instead of "background-position". Is there a way to target the CSS hover attribute within my JavaScript function?