[英]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.