小编use*_*765的帖子

JavaScript函数不会触发

我正在构建一个使用JavaScript的移动页面,使顶级菜单下拉和关闭,但它无法正常工作.这是JS

<script>
window.onload = function () { 
var elem = document.getElementById('navBarMobile');
var burger = document.getElementById('hamburgerMobile');
var cross = document.getElementById('crossMobile');
}

function menuExpand() {

    elem.style.transition = "height 1s linear 0s";
    elem.style.height = "292px";

    burger.style.transition = "opacity 0.5s linear 0s";
    burger.style.opacity = "0";
    burger.style.zIndex = "0";

    cross.style.transition = "opacity 0.5s linear 0.5s"
    cross.style.opacity = "1";
    cross.style.zIndex = "1";
}

function menuClose() {

    elem.style.transition = "height 1s linear 0s";
    elem.style.height = "87px";

    burger.style.transition = "opacity 0.5s linear 0.5s";
    burger.style.opacity = "1";
    burger.style.zIndex = …
Run Code Online (Sandbox Code Playgroud)

javascript mobile web

1
推荐指数
1
解决办法
80
查看次数

标签 统计

javascript ×1

mobile ×1

web ×1