简体   繁体   English

显示/隐藏jQuery菜单

[英]Show/Hide jQuery menu

I want a show/hide menu for my website. 我想为我的网站显示/隐藏菜单。

I want it to function like the one on www.nicolaspopupshop.com when you click on "Partners" at the bottom of the site. 当您单击网站底部的"Partners"时,我希望它的功能类似于www.nicolaspopupshop.com上的功能。

I've tried to do this all day, I'm just so confused at how it works. 我整天都在尝试这样做,但是我对它的工作方式感到困惑。

I'm pretty good with HTML but once javascript comes into play I'm clueless. 我对HTML相当满意,但是一旦javascript开始发挥作用,我就一无所知。 I guess this is an annoying question for experts but it would mean the world to me if someone could help me out. 我想这对专家来说是一个烦人的问题,但是如果有人可以帮助我,这对我来说将意味着一个世界。

Thanks! 谢谢!

Here is what I have in the style tag: 这是样式标签中的内容:

#footer .bottom #partners_trigger {
      cursor: pointer;
      margin-left: 170px; }
    #footer .bottom #partner_list {
      width: 320px;}
    #footer .bottom #partner_list ul {
      position: fixed;
      text-align:center;
      font-size:11px;
      text-transform: uppercase;
      bottom: 40px;
      left: 50%;
      width: 320px;
      margin: 0 0 0 -160px;
      background: #FA9313;
      background: rgba(250, 147, 19, 0.85);
      padding: 10px 0;
      -webkit-border-radius: 6px;
      -moz-border-radius: 6px;
      border-radius: 6px;
      z-index: 300;
      line-height: 18px;
      display: none; }
      #footer .bottom #partner_list ul a {
        color: white; 
        font-family: Arial, Helvetica;}
      #footer .bottom #partner_list ul a:hover {
        color: #e9118c; }
      #footer .bottom #partner_list ul.active {
        display: block; }

I tried to put what I have in the body tag but I can't get it to display properly. 我试图将我的物品放入body标签,但无法正确显示。

$(document).ready(function() {
    var $list = $("#your-ul");
    $("#your-toggle-link").bind('click', function() {
       $list.slideToggle();
    })
});

First create a div and set its style as display:none. 首先创建一个div并将其样式设置为display:none。 I assume that your Partners link has an id Partners Then write the code below 我假设您的合作伙伴链接的ID为合作伙伴,然后在下面编写代码

$(document).ready(function() {
    $("#Partners").bind('click', function() {
      $("#your_div").slideToggle(); //your_div is the id of the div with display none
    })
});

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

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