static/less/dropdowns.less
author stetrabby <info@trabucchi.de>
Fri, 20 Dec 2013 22:30:44 +0100
changeset 53 3416f82943ea
permissions -rwxr-xr-x
less initial added
info@53
     1
//
info@53
     2
// Dropdown menus
info@53
     3
// --------------------------------------------------
info@53
     4
info@53
     5
info@53
     6
// Dropdown arrow/caret
info@53
     7
.caret {
info@53
     8
  display: inline-block;
info@53
     9
  width: 0;
info@53
    10
  height: 0;
info@53
    11
  margin-left: 2px;
info@53
    12
  vertical-align: middle;
info@53
    13
  border-top:   @caret-width-base solid;
info@53
    14
  border-right: @caret-width-base solid transparent;
info@53
    15
  border-left:  @caret-width-base solid transparent;
info@53
    16
}
info@53
    17
info@53
    18
// The dropdown wrapper (div)
info@53
    19
.dropdown {
info@53
    20
  position: relative;
info@53
    21
}
info@53
    22
info@53
    23
// Prevent the focus on the dropdown toggle when closing dropdowns
info@53
    24
.dropdown-toggle:focus {
info@53
    25
  outline: 0;
info@53
    26
}
info@53
    27
info@53
    28
// The dropdown menu (ul)
info@53
    29
.dropdown-menu {
info@53
    30
  position: absolute;
info@53
    31
  top: 100%;
info@53
    32
  left: 0;
info@53
    33
  z-index: @zindex-dropdown;
info@53
    34
  display: none; // none by default, but block on "open" of the menu
info@53
    35
  float: left;
info@53
    36
  min-width: 160px;
info@53
    37
  padding: 5px 0;
info@53
    38
  margin: 2px 0 0; // override default ul
info@53
    39
  list-style: none;
info@53
    40
  font-size: @font-size-base;
info@53
    41
  background-color: @dropdown-bg;
info@53
    42
  border: 1px solid @dropdown-fallback-border; // IE8 fallback
info@53
    43
  border: 1px solid @dropdown-border;
info@53
    44
  border-radius: @border-radius-base;
info@53
    45
  .box-shadow(0 6px 12px rgba(0,0,0,.175));
info@53
    46
  background-clip: padding-box;
info@53
    47
info@53
    48
  // Aligns the dropdown menu to right
info@53
    49
  &.pull-right {
info@53
    50
    right: 0;
info@53
    51
    left: auto;
info@53
    52
  }
info@53
    53
info@53
    54
  // Dividers (basically an hr) within the dropdown
info@53
    55
  .divider {
info@53
    56
    .nav-divider(@dropdown-divider-bg);
info@53
    57
  }
info@53
    58
info@53
    59
  // Links within the dropdown menu
info@53
    60
  > li > a {
info@53
    61
    display: block;
info@53
    62
    padding: 3px 20px;
info@53
    63
    clear: both;
info@53
    64
    font-weight: normal;
info@53
    65
    line-height: @line-height-base;
info@53
    66
    color: @dropdown-link-color;
info@53
    67
    white-space: nowrap; // prevent links from randomly breaking onto new lines
info@53
    68
  }
info@53
    69
}
info@53
    70
info@53
    71
// Hover/Focus state
info@53
    72
.dropdown-menu > li > a {
info@53
    73
  &:hover,
info@53
    74
  &:focus {
info@53
    75
    text-decoration: none;
info@53
    76
    color: @dropdown-link-hover-color;
info@53
    77
    background-color: @dropdown-link-hover-bg;
info@53
    78
  }
info@53
    79
}
info@53
    80
info@53
    81
// Active state
info@53
    82
.dropdown-menu > .active > a {
info@53
    83
  &,
info@53
    84
  &:hover,
info@53
    85
  &:focus {
info@53
    86
    color: @dropdown-link-active-color;
info@53
    87
    text-decoration: none;
info@53
    88
    outline: 0;
info@53
    89
    background-color: @dropdown-link-active-bg;
info@53
    90
  }
info@53
    91
}
info@53
    92
info@53
    93
// Disabled state
info@53
    94
//
info@53
    95
// Gray out text and ensure the hover/focus state remains gray
info@53
    96
info@53
    97
.dropdown-menu > .disabled > a {
info@53
    98
  &,
info@53
    99
  &:hover,
info@53
   100
  &:focus {
info@53
   101
    color: @dropdown-link-disabled-color;
info@53
   102
  }
info@53
   103
}
info@53
   104
// Nuke hover/focus effects
info@53
   105
.dropdown-menu > .disabled > a {
info@53
   106
  &:hover,
info@53
   107
  &:focus {
info@53
   108
    text-decoration: none;
info@53
   109
    background-color: transparent;
info@53
   110
    background-image: none; // Remove CSS gradient
info@53
   111
    .reset-filter();
info@53
   112
    cursor: not-allowed;
info@53
   113
  }
info@53
   114
}
info@53
   115
info@53
   116
// Open state for the dropdown
info@53
   117
.open {
info@53
   118
  // Show the menu
info@53
   119
  > .dropdown-menu {
info@53
   120
    display: block;
info@53
   121
  }
info@53
   122
info@53
   123
  // Remove the outline when :focus is triggered
info@53
   124
  > a {
info@53
   125
    outline: 0;
info@53
   126
  }
info@53
   127
}
info@53
   128
info@53
   129
// Dropdown section headers
info@53
   130
.dropdown-header {
info@53
   131
  display: block;
info@53
   132
  padding: 3px 20px;
info@53
   133
  font-size: @font-size-small;
info@53
   134
  line-height: @line-height-base;
info@53
   135
  color: @dropdown-header-color;
info@53
   136
}
info@53
   137
info@53
   138
// Backdrop to catch body clicks on mobile, etc.
info@53
   139
.dropdown-backdrop {
info@53
   140
  position: fixed;
info@53
   141
  left: 0;
info@53
   142
  right: 0;
info@53
   143
  bottom: 0;
info@53
   144
  top: 0;
info@53
   145
  z-index: @zindex-dropdown - 10;
info@53
   146
}
info@53
   147
info@53
   148
// Right aligned dropdowns
info@53
   149
.pull-right > .dropdown-menu {
info@53
   150
  right: 0;
info@53
   151
  left: auto;
info@53
   152
}
info@53
   153
info@53
   154
// Allow for dropdowns to go bottom up (aka, dropup-menu)
info@53
   155
//
info@53
   156
// Just add .dropup after the standard .dropdown class and you're set, bro.
info@53
   157
// TODO: abstract this so that the navbar fixed styles are not placed here?
info@53
   158
info@53
   159
.dropup,
info@53
   160
.navbar-fixed-bottom .dropdown {
info@53
   161
  // Reverse the caret
info@53
   162
  .caret {
info@53
   163
    border-top: 0;
info@53
   164
    border-bottom: @caret-width-base solid;
info@53
   165
    content: "";
info@53
   166
  }
info@53
   167
  // Different positioning for bottom up menu
info@53
   168
  .dropdown-menu {
info@53
   169
    top: auto;
info@53
   170
    bottom: 100%;
info@53
   171
    margin-bottom: 1px;
info@53
   172
  }
info@53
   173
}
info@53
   174
info@53
   175
info@53
   176
// Component alignment
info@53
   177
//
info@53
   178
// Reiterate per navbar.less and the modified component alignment there.
info@53
   179
info@53
   180
@media (min-width: @grid-float-breakpoint) {
info@53
   181
  .navbar-right {
info@53
   182
    .dropdown-menu {
info@53
   183
      .pull-right > .dropdown-menu();
info@53
   184
    }
info@53
   185
  }
info@53
   186
}
info@53
   187
Impressum Datenschutzerklärung