0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

add $use-hover-media-query to control @media (hover:hover) usage

This commit is contained in:
Chris Rebert 2015-01-20 15:35:28 -08:00
parent eaaaa00520
commit fd13e33aa4
2 changed files with 46 additions and 13 deletions

View File

@ -50,6 +50,8 @@ $enable-transitions: true !default;
$spacer: 1rem !default;
$border-width: .075rem !default;
$use-hover-media-query: false !default;
//== Typography
//
//## Font, line-height, and color for body text, headings, and more.

View File

@ -1,28 +1,59 @@
@mixin hover {
// See Media Queries Level 4: http://drafts.csswg.org/mediaqueries/#hover
// Currently shimmed by https://github.com/cvrebert/mq4-hover-hover-shim
@media (hover: hover) {
@if $use-hover-media-query {
// See Media Queries Level 4: http://drafts.csswg.org/mediaqueries/#hover
// Currently shimmed by https://github.com/cvrebert/mq4-hover-hover-shim
@media (hover: hover) {
&:hover { @content }
}
}
@else {
&:hover { @content }
}
}
@mixin hover-focus {
&:focus { @content }
@include hover { @content }
@if $use-hover-media-query {
&:focus { @content }
@include hover { @content }
}
@else {
&:focus,
&:hover {
@content
}
}
}
@mixin plain-hover-focus {
&,
&:focus {
@content
@if $use-hover-media-query {
&,
&:focus {
@content
}
@include hover { @content }
}
@else {
&,
&:focus,
&:hover {
@content
}
}
@include hover { @content }
}
@mixin hover-focus-active {
&:focus,
&:active {
@content
@if $use-hover-media-query {
&:focus,
&:active {
@content
}
@include hover { @content }
}
@else {
&:focus,
&:active,
&:hover {
@content
}
}
@include hover { @content }
}