简体   繁体   English

jQuery切换菜单和jQuery显示和隐藏翻转

[英]Jquery Toggle Menu and Jquery Show and Hide with rollover

I am working on a navigation and have a couple of issues with Jquery. 我正在做一个导航,并且Jquery有几个问题。

1) When hovered on the image on the right hand side of the menu the dropdown menu needs to be displayed only when hovered over the right image. 1)当将鼠标悬停在菜单右侧的图像上时,仅当将鼠标悬停在右侧图像上时才需要显示下拉菜单。

2) when you make the screen less than 800px it will show a drop down menu. 2)当您使屏幕小于800px时,它将显示一个下拉菜单。 I want the menu to toggle up and down smoothly using the red button 我希望菜单使用红色按钮平稳地上下切换

Can anybody assist? 有人可以协助吗?

http://jsfiddle.net/558pA/1/ http://jsfiddle.net/558pA/1/

/*  MAIN MENU DROPDOWN
===================================*/
$(".toggle-nav").click(function () {
    $("#nav").slideToggle('slow');
});

/*  MAIN SETTINGS SHOW AND HIDE
===================================*/

('.user-profile').hover(

function () {
    $(this).show();
},

function () {
    $(this).hide();
});

Change $(".toggle-nav") to $("#toggle-nav") , and add a # to the href: $(".toggle-nav")更改$("#toggle-nav") ,并在href中添加#

<a href="#" id="toggle-nav">Toggle navigation</a>

... ...

$("#toggle-nav").click(function () {
    $("#nav").slideToggle('slow');
});

Woking demo: http://jsfiddle.net/n8zqS/ 沃金(Woking)演示: http : //jsfiddle.net/n8zqS/

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM