Last active
August 29, 2015 14:02
-
-
Save Craga89/7958139ef4ca1edad786 to your computer and use it in GitHub Desktop.
Bootstrap 3 - Disabled dropdown links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Bootstrap 3 - Disabled dropdown links | |
Bootstrap 3 has built-in visual support for disabled dropdown menu items, however these are simply | |
visual changes and don't actually impact the interactivity of the element itself. | |
Once this is added to your styles, you can easily disable any dropdown item by applying a [disabled] attribute | |
to the <a/> element itself, and adding the usual .disabled class to the parent <li>. | |
More information here: http://blog.craigsworks.com/bootstrap-3-disabled-dropdown-links/ | |
**/ | |
/* | |
Mimic cursor style from native .dropdown-menu > .disabled > a{} styles, | |
since `pointer-events: none` kills the cursor state, too. | |
*/ | |
.dropdown-menu > .disabled{ | |
cursor: not-allowed; | |
} | |
/* The real magic ;) */ | |
.dropdown-menu > .disabled > a{ | |
pointer-events: none; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.dropdown-menu > .disabled > a { | |
&, | |
&:hover, | |
&:focus { | |
color: @dropdown-link-disabled-color; | |
} | |
} | |
// Nuke hover/focus effects | |
.dropdown-menu > .disabled > a { | |
&:hover, | |
&:focus { | |
text-decoration: none; | |
background-color: transparent; | |
background-image: none; // Remove CSS gradient | |
.reset-filter(); | |
cursor: not-allowed; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More information here: http://blog.craigsworks.com/bootstrap-3-disabled-dropdown-links/