JQuery drill down popup like google settings in gmail

Hi,

I am looking for any plugin in JQuery to show drill down popup like settings in Gmail.

Attached image for reference.

Any advise.

-Thanks

Attached image

Hi,

You shouldn’t need a plugin for this - it’s just a matter of styling a div correctly using CSS, then using JS to show/hide it.

CSS isn’t my strongest suit, but here’s what I came up with having examined the code on the Google site.
I’m sure it could be tidied up somewhat.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Settings button</title>  
    <style>
      .settings {
        -webkit-border-radius: 2px;
        border-radius: 2px;
        cursor: default;
        font-size: 11px;
        font-weight: bold;
        text-align: center;
        white-space: nowrap;
        margin-right: 16px;
        height: 27px;
        line-height: 27px;
        min-width: 54px;
        outline: 0;
        padding: 0 8px;
        -webkit-box-shadow: none;
        box-shadow: none;
        background-color: #f5f5f5;
        background-image: -webkit-linear-gradient(top,#f5f5f5,#f1f1f1);
        background-image: linear-gradient(top,#f5f5f5,#f1f1f1);
        color: #444;
        border: 1px solid #dcdcdc;
        border: 1px solid rgba(0,0,0,0.1);
        position: relative;
        display: inline-block;
        float:right;
      }

      .cog {
        background: no-repeat url(sprites.png) 0 -472px;
        height: 21px;
        width: 21px;
        position: relative;
        display: inline-block;
        opacity: .55;
        margin-top: -3px;
        vertical-align: middle;
      }

      .down-arrow {
        height: 6px;
        width: 7px;
        background: url(arrow_down.png) no-repeat 0 1px;
        vertical-align: middle;
        font-size: 0;
        margin-left: 3px;
        position: relative;
        display: inline-block;
        opacity: .55;
        margin-top: -3px;
        vertical-align: middle;
      }

      .settings-options{
        clear:both;
        float:right;
        margin-right:16px;
        margin-top: 0px;
        list-style: none;
        text-align: left;
        line-height:160%;
        padding: 0;
        display: none;
        
        -webkit-border-radius: 0;
        border-radius: 0;
        -webkit-box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        -webkit-transition: opacity .218s;
        transition: opacity .218s;
        background: #fff;
        border: 1px solid #ccc;
        border: 1px solid rgba(0,0,0,.2);
        cursor: default;
        outline: none;
      }

      .settings-options a{
        text-decoration: none;
        color: black;
        padding-left: 20px;
      }

      .settings-options li{
        width: 180px;
        margin-top: 3px;
      }

      .settings-options li:hover{
        background-color: #F0F0F0;
      }
    </style>
  </head>
  <body>
    <div class="settings">
      <div class="cog"></div>
      <div class="down-arrow">&nbsp;</div>
    </div>
    <ul class="settings-options">
      <li><a href="#">This is Option 1</a></li>
      <li><a href="#">This is Option 2</a></li>
      <li><a href="#">This is Option 3</a></li>
    </ul>

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script>
      $(".settings").on("click", function(){
        $(".settings-options").toggle();
      })
    </script>
  </body>
</html>

Please be aware that the images are probably copyright, so you may have to find your own versions.
You also don’t need jQuery to do the show/hide thing, but I was feeling lazy.

Here’s a demo.

Many thanks Pullo.

It works. I will use new different images for setting buttons.

-Thanks

Hi Pullo,

One small change when we click outside then popup do not close.

Any idea?

-Thanks

Sure :slight_smile:
I would attach a click event listener to the document which, when it detects a click, checks if the menu is visible and reacts accordingly.

Hi Pullo,

Any update.

-Thanks

Hi,

See my previous post. That’s how I’d do it :slight_smile: