Skip to content

Commit

Permalink
update dropdown css and js
Browse files Browse the repository at this point in the history
  • Loading branch information
sesemaya committed Mar 11, 2015
1 parent 7227869 commit e3e0604
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 7 deletions.
6 changes: 5 additions & 1 deletion css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -6092,7 +6092,7 @@ a.fbtn:focus, a.fbtn:hover {
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.15); }
.dropdown.open .dropdown-menu {
display: block; }
.pull-right .dropdown-menu {
.dropdown-menu.dropdown-menu-right, .nav.pull-right .dropdown-menu {
border-radius: 2px 0 2px 2px;
right: 0;
left: auto; }
Expand Down Expand Up @@ -7450,6 +7450,10 @@ legend[class*="col-xx-"] {
background-color: #ffa000; }
.header a {
color: white; }
.header .dropdown.open .dropdown-toggle {
color: #212121; }
.header .dropdown-menu a {
color: #212121; }
.header .nav {
margin: 0; }
.header .nav > li > a .avatar,
Expand Down
2 changes: 1 addition & 1 deletion css/base.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,6 @@ <h3 class="content-sub-heading">Examples</h3>
</div>
</div>

<script src="/js/base.js" type="text/javascript"></script>
<script src="/js/base.min.js" type="text/javascript"></script>
</body>
</html>
11 changes: 10 additions & 1 deletion js/base.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/base.min.js

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion js/src/dropdown.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
// dropdown menu max-width
$('.dropdown').on('show.bs.dropdown', function () {
$('.dropdown-menu', $(this)).css('max-width', $(window).width() - $('.container').css('padding-left').replace('px', '') * 4);
var $dropdownMenu = $('.dropdown-menu', $(this)),
$dropdownToggle = $('.dropdown-toggle', $(this)),
dropdownPadding = $('a', $dropdownMenu).css('padding-left').replace('px', ''),
dropdownWidth;
if ($dropdownMenu.hasClass('dropdown-menu-right') || $dropdownMenu.parents('.nav.pull-right').length) {
dropdownWidth = $dropdownToggle.offset().left + $dropdownToggle.outerWidth() - dropdownPadding;
} else {
dropdownWidth = $(window).width() - $dropdownToggle.offset().left - dropdownPadding;
}
$dropdownMenu.css('max-width', dropdownWidth);
});
3 changes: 2 additions & 1 deletion sass/element/_dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
.dropdown.open & {
display: block;
}
.pull-right & {
&.dropdown-menu-right,
.nav.pull-right & {
border-radius: 2px 0 2px 2px;
// position
right: 0;
Expand Down
6 changes: 6 additions & 0 deletions sass/theme/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@
a {
color: $white;
}
.dropdown.open .dropdown-toggle {
color: $black-text;
}
.dropdown-menu a {
color: $black-text;
}
.nav {
margin: 0;
> li {
Expand Down

0 comments on commit e3e0604

Please sign in to comment.