javascript - Change css button to css active without link -
We have a problem with our CSS styles on our website is a top menu The problem is that we have to work with buttons Has been done, just to set some more. But we can not use the "active" CSS style because there is no URL associated with this link.
Can this help us?
This is our menu html:
& lt; Header & gt; & Lt; Div class = "container" & gt; & Lt; NAV & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "javascript: zero (0)" square = "icon an" id = "box_on" & gt; But a & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "javascript: zero (0)" square = "icon two" id = "box_ two" & gt; Two button & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Neo & gt; & Lt; / Div & gt; & Lt; / Header & gt; This function is triggered, that part is working correctly. Function change () is in the function of my function!
document.getElementById ('box_two'). AddEventListener ("click", myFunction); The CSS style of the section that is active when clicking on the button and clicking on the button again:
#actieflink: active {padding - Correct: 16px; Background-color: # 004D0e; Border-right: 0; -WebKit-Box-Shadow: Inset 0 0 3px RGBA (0, 0, 0, 0.7); Box-Shadow: Inset 0 0 3px RGBA (0, 0, 0, 0.7); } I tried to do this but it does not work for me
function changes () {document.getElementById ("actieflink"). ClassName = 'active'; }
I have made an example here. Http://codepen.io/anon/pen/dPRPJJ Setting it to active mode by clicking on a link it leads to active mode again.
Comments
Post a Comment