单击按钮后,将用户重定向到菜单部分,从屏幕底部弹出导航栏

发布于 2025-02-09 09:54:04 字数 884 浏览 1 评论 0原文

感谢Rene现在有效的第一部分。 :)

我有一个我不知道如何修复的错误:

  • 它的工作是从屏幕底部弹出NAV栏,以使用户知道它的位置,并且在半半之后恢复了其次
  • ,然后用户可以将其悬停在它上,并且它会自动弹出并只要鼠标在其上,并且在鼠标上就可以静置,并且在鼠标上,它可以达到其第一个位置。

问题: ***按钮操作后,Hover Animation不再起作用,是因为JS覆盖CSS NAV:HOVER,如果是这样,您可能知道如何修复它。谢谢您的帮助确实很有帮助!

这是JS代码:

//nav popup

const navHover = function navHover() {
  const nav = document.getElementById("nav");

  nav.style.transition = "all 1s";
};

///////////////////////////////////////////////////////////////////////////
//Menu button

const openNav = function openNav() {
  const menuButton = document.getElementById("menuButton");
  const nav = document.getElementById("nav");

    nav.style.height = "50px";
    console.log("to 50px");

    setTimeout(function navBackDown() {
      nav.style.height = "10px";
      console.log("to 10px");
    }, 600);
};

谢谢您的帮助。

Thanks to Rene for the first part that works now. :)

I have a bug that I don't know how to fix:

  • its job is to pop up nav bar from the bottom of the screen for half of second so that user know where it is and than it gets back down after half a second
  • then user can hover over it and it pops up automatically and stays up as long as mouse is on it, and on mouse out it gets to its first position.

Problem:
***after button action, hover animation doesn't work anymore, is that because JS overwrites CSS nav:hover, and if so do you maybe know how to fix it. Thank you for help really helps a lot!

and here is JS code:

//nav popup

const navHover = function navHover() {
  const nav = document.getElementById("nav");

  nav.style.transition = "all 1s";
};

///////////////////////////////////////////////////////////////////////////
//Menu button

const openNav = function openNav() {
  const menuButton = document.getElementById("menuButton");
  const nav = document.getElementById("nav");

    nav.style.height = "50px";
    console.log("to 50px");

    setTimeout(function navBackDown() {
      nav.style.height = "10px";
      console.log("to 10px");
    }, 600);
};

Thank you for help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

递刀给你 2025-02-16 09:54:04

我已经知道了:)再次感谢rene的帮助,

////////////////////////////////////////////////////////////////////////////
//nav popup

const navHover = function navHover() {
  const nav = document.getElementById("nav");
  console.log("hovered")
  
  nav.style.height = "80px";
  nav.style.transition = "all 1s";
  
};

function navOut(){
  nav.style.height = "10px";
  console.log("to 10px");
}

////////////////////////////////////////////////////////////////////////////
//Menu button

const openNav = function openNav() {
  const menuButton = document.getElementById("menuButton");
  const nav = document.getElementById("nav");


    nav.style.height = "50px";
    console.log("to 50px");

    setTimeout(function navBackDown() {
      nav.style.height = "10px";
      console.log("to 10px");
    }, 600);
    
};


我不知道为什么,但是当我“给它一段时间”之间的帮助:)

I have got it :) thank you Rene once more for help

////////////////////////////////////////////////////////////////////////////
//nav popup

const navHover = function navHover() {
  const nav = document.getElementById("nav");
  console.log("hovered")
  
  nav.style.height = "80px";
  nav.style.transition = "all 1s";
  
};

function navOut(){
  nav.style.height = "10px";
  console.log("to 10px");
}

////////////////////////////////////////////////////////////////////////////
//Menu button

const openNav = function openNav() {
  const menuButton = document.getElementById("menuButton");
  const nav = document.getElementById("nav");


    nav.style.height = "50px";
    console.log("to 50px");

    setTimeout(function navBackDown() {
      nav.style.height = "10px";
      console.log("to 10px");
    }, 600);
    
};


I don't exactly know why but when I "gave it some time" in between it just worked :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文