Home >Web Front-end >JS Tutorial >javascript+css3 implements dynamic button menu effects_javascript skills
A menu button special effects case that simply implements dynamic effects.
Without further ado, I will post the code directly for you. Please give me some advice as to whether the code is good or not.
<div class="bar" id="menubar"> <div class="menu" id="menu0"> </div> <div class="menu" id="menu1"> </div> <div class="menu" id="menu2"> </div> </div> .bar{ width:px; height:px; border:px solid #ccc; border-radius:%; position:fixed; top:px; right:px; z-index:; cursor:pointer; } .menu{ width:px; height:px; background-color:#ccc; position:absolute; transform:translated(-%,-%,); left:%; transition:all .s cubic-bezier(., ., ., .) s } #menu{ top:%; } #menu{ top:%; } #menu{ top:%; } window.onload = function () { var menubar = document.getElementById("menubar"); var menu = document.getElementById("menu"); var menu = document.getElementById("menu"); var menu = document.getElementById("menu"); var i = ; menubar.onclick = function () { i++; if (i % == ) { menu.style.top = + "%"; menu.style.display = "none"; menu.style.top = + "%"; menu.style.transform = "translated(-%,-%,) rotate(deg)"; menu.style.transform = "translated(-%,-%,) rotate(deg)"; } else { menu.style.transform = "translated(-%,-%,) rotate(deg)"; menu.style.transform = "translated(-%,-%,) rotate(deg)"; menu.style.top = + "%"; menu.style.top = + "%"; menu.style.display = "block"; } } }
The above code simply implements dynamic button menu effects. I hope it will be helpful to everyone.