2016-09-26 3 views
0

ナビゲーションリンクに下線を引くホバー効果を使用します。 Safariにカーソルを合わせると、最初のホバーの背景が私のCSSに従って表示されますが、オレンジ色の背景が表示されます。この橙色の背景が見えない擬似要素の高さを削除すると見つかりました。ハーフバグ:before Safariで

@mixin underline-reveal { 

    vertical-align: middle; 
    -webkit-transform: translateZ(0); 
    transform: translateZ(0); 
    box-shadow: 0 0 1px rgba(0, 0, 0, 0); 
    -webkit-backface-visibility: hidden; 
    backface-visibility: hidden; 
    -moz-osx-font-smoothing: grayscale; 
    position: relative; 
    overflow: hidden; 
    } 


    @mixin underline-reveal-before ($color) { 
    content: ""; 
    position: absolute; 
    z-index: -1; 
    left: 0; 
    right: 0; 
    bottom: 0; 
    background-color: $color; 
    height: 3px; 
    -webkit-transform: translateY(4px); 
    transform: translateY(4px); 
    -webkit-transition-property: transform; 
    transition-property: transform; 
    -webkit-transition-duration: 0.3s; 
    transition-duration: 0.3s; 
    -webkit-transition-timing-function: ease-out; 
    transition-timing-function: ease-out; 
    } 

enter image description here

答えて

0

通常最良の修正は-webkit-変換を追加することです:translate3d(0,0,0)Safariでの移行を持つ要素の上に。私の場合は

ul { 
    @include menu-base; 
    background-color: $blue; 
    line-height: 2.5; 

    > li { 
     display: inline-block; 

     > a { 
      @include mainnav-align-a; 
      @include underline-reveal; 
     } 

     > a::before { 
      @include underline-reveal-before (#EDEDED); 
      height: 3px; 
     } 

     > a:focus, 
     > a:hover { 
      background-color: $hover-blue; 
     } 

     > a:focus::before, 
     > a:hover::before { 
      -webkit-transform: translateY(0px); 
      transform: translateY(0px); 
       <!--Fix bugs ON Safari--> 
      -webkit-transform: translate3d(0, 0, 0); 
     } 

     a.active:before { 
      display: none; 
     } 
    } 
}