From: Chris Rebert Date: Tue, 20 Jan 2015 23:35:28 +0000 (-0800) Subject: add $use-hover-media-query to control @media (hover:hover) usage X-Git-Tag: v4.0.0-alpha~375^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd13e33aa4a662875cf367d8e0f012613cdc8447;p=thirdparty%2Fbootstrap.git add $use-hover-media-query to control @media (hover:hover) usage --- diff --git a/scss/_variables.scss b/scss/_variables.scss index 60fb87015e..2a1f8e25b7 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -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. diff --git a/scss/mixins/_hover.scss b/scss/mixins/_hover.scss index 4c415e9b44..fb5b520165 100644 --- a/scss/mixins/_hover.scss +++ b/scss/mixins/_hover.scss @@ -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 } }