简体   繁体   English

如何将鼠标悬停在菜单按钮上,然后出现选择项?

[英]How do I hover over the menu button and the selections appear?

What's Wrong with this jquery if I want to: Hover over #menu (the whole thing) and then all the other menu selections appear beneath that. 如果需要,此jquery有什么问题:将鼠标悬停在#menu (整个菜单)上,然后所有其他菜单选择都显示在该菜单下。 These selections are .menubox , but I grouped them all separate from .menuboxSuperior as #others . 这些选择是.menubox ,但是我将它们与.menuboxSuperior分别分组为#others The top box which is always showing (menu) is called .menuboxSuperior. 始终显示(菜单)的顶部框称为.menuboxSuperior. Also when I hover over the whole thing ( #menu ) I want the opacity to increase from 0.4 to 0.9 in 200ms. 另外,当我将鼠标悬停在整个对象上时( #menu ),我希望不透明度在200毫秒内从0.4增加到0.9。 None of this is working for me. 这些都不对我有用。 What should I do? 我该怎么办?

jQuery: jQuery的:

$(document).ready(function(){
    $('.menubox').hide();

$('#menu').mouseenter(function(){
    $(this).fadeTo(200 0.9);
});

$('#menu').mouseleave(function(){
    $(this).fadeTo(200 0.4);
});

$('#menu').mouseenter(function(){
    $('#others').show();
});

$('#menu').mouseleave(function(){
    $('#others').hide();
});

});

THANK YOU VERY MUCH! 非常感谢你!

you're missing a comma 您缺少逗号

$(this).fadeTo(200 0.9);
$(this).fadeTo(200 0.4);

should be 应该

$(this).fadeTo(200, 0.9);
$(this).fadeTo(200, 0.4);

most modern browsers have developer tools with a console that will show simple errors like this - firefox shows SyntaxError: missing ) after argument list in this case, and shows exactly which line in your code you have wrong. 大多数现代的浏览器都具有带有控制台的开发人员工具,该控制台将显示诸如此类的简单错误-在这种情况下,firefox SyntaxError: missing ) after argument list显示SyntaxError: missing ) after argument list ,并确切显示您在代码中哪一行错了。 If you want to develop, use developer tools 如果要开发,请使用开发人员工具

暂无
暂无

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

相关问题 当我将鼠标悬停在另一个 div 上时,如何使文本出现在 div 中? - How do I make text appear in a div when I hover over another? cursor hover时如何让子菜单出现在每个菜单上? - How do I make the submenu appear on each menu when cursor hover? 当我使用 Material UI CSS 语法在 hover 上方时,如何使删除图标(菜单项中的子组件)出现? - How to make the delete icon, which is child component in the Menu Item appear when I hover over it with Material UI CSS syntax? 如何为 2 个单选按钮选择编写 Java 脚本计算? - How do I write Java Script calculation for 2 radio button selections? 当我将鼠标悬停在按钮边缘时,如何使所有条形变为黑色? - How do i get all of my bars to turn black when I hover over the edge of the button? 将鼠标悬停在图像上后如何在其上显示菜单? - How can I have a menu appear over an image after it is hovered on? 用户单击“提交”按钮后,如何使图像或图标出现在另一图像上? - After a user hits the submit button, how do I make an image or icon appear over another image? 带有文本标签的按钮:即使在文本标签上方,如何保持悬停颜色? - Button with text label: How do I keep the hover color even when over text label? 将鼠标悬停在另一个div的按钮上时,如何更改div的背景? - how do i change a div background when you hover over a button in another div? 将鼠标悬停在按钮上可以显示包含子菜单的菜单 - Hover over button to expose menu which contains a sub menu
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM