简体   繁体   English

在删除JQuery中的类后,为什么我的导航不调整大小?

[英]Why does my nav not resize after removing class in JQuery?

I have been working on this website since last week. 自上周以来,我一直在该网站上工作。 It is a school project, and I can't figure out why part of it isn't working. 这是一个学校项目,我无法弄清楚为什么其中一部分无法使用。 When I scroll down, click on the menu button, leave the menu down, then scroll back up, the navbar keeps its height even though I take away the class that resized it. 当我向下滚动时,单击菜单按钮,使菜单保持向下,然后向上滚动,即使我取消了调整其大小的类,导航栏仍保持其高度。 I have attempted to use Google Chrome's developer tools to see what is happening. 我试图使用Google Chrome浏览器的开发人员工具来查看发生了什么。 It just shows the height property crossed out. 它仅显示掉掉了height属性。 I have no idea why it won't work, and I have looked for any reason in my code. 我不知道为什么它不起作用,并且出于任何原因我都在代码中进行了查找。 I also tried it in Internet Explorer to see if chrome was just having problems with it for some reason. 我还在Internet Explorer中尝试了它,以查看chrome是否由于某种原因而出现问题。 It did the same thing there causing me to assume the problem is in my code. 它在那里做了同样的事情,使我认为问题出在我的代码中。

Here is a link to the website it is currently published on: http://www.dragonmath.net/rockets/ 这是当前发布在其上的网站的链接: http : //www.dragonmath.net/rockets/

Html Code: http://www.dragonmath.net/rockets/index.html HTML程式码: http//www.dragonmath.net/rockets/index.html

Javascript Code: http://www.dragonmath.net/rockets/javascript/main.js Javascript代码: http//www.dragonmath.net/rockets/javascript/main.js

CSS Sheet 1: http://www.dragonmath.net/rockets/styles/main.css CSS工作表1: http//www.dragonmath.net/rockets/styles/main.css

CSS Sheet 2: http://www.dragonmath.net/rockets/styles/function.css CSS工作表2: http//www.dragonmath.net/rockets/styles/function.css

got problem!! 有问题! After scrolling back to top you didn't change height of nav element;after scroll back make it 40px again it may solve your problem. 滚动到顶部后,您没有更改nav元素的高度;再次滚动到40px后,它可能会解决您的问题。

if (flag !== 2 && $(window).scrollTop() === 0) {

        //add this line
        $nav.css({height:'40px'});

        $nav.slideUp();
        $nav.removeClass("dropDown");
        $menu.stop(true,false).slideUp(800, function () {
            $heading.css({'margin-left':'40px'})
        });
        $nav.stop(true,false).slideDown();
        flag = 2;
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我的 JavaScript/JQuery 添加和删除带有函数的类不起作用? - Why is my JavaScript/JQuery adding and removing class with function not working? 扩展后,Bootstrap Collapse为什么会继续删除“ collapse”类? - Why does Bootstrap Collapse keep removing the “collapse” class after expanding? 为什么 jQuery toggleClass 不删除 class? - Why is jQuery toggleClass not removing a class? 当我单击图像滑块上的导航点时,为什么我的jQuery滑块会发疯? - Why does my jQuery slider go mad when I click a nav dot on my image slider? 为什么我的自适应导航无法切换课程? - Why will my responsive nav not toggle class? 为什么在Jquery中添加“blocker”类后,我的事件绑定不再触发? - Why does my event binding not trigger any more after adding a “blocker” class in Jquery? 为什么我的引导导航栏为斜体而不是将活动类添加到活动选项卡? - Why does my bootstrap nav bar italicize instead of adding the active class to the active tab? 调整大小后删除事件侦听器 - Removing eventListeners after a resize JavaScript:如何在删除“调整大小”事件后添加一个类? - JavaScript: How do I add a class on a 'resize' event after removing it? 从jQuery Mobile标头中删除导航栏不会调整标头的大小 - removing a navbar from a jQuery Mobile header does not resize header
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM