• <i id='uhawh'><tr id='uhawh'><dt id='uhawh'><q id='uhawh'><span id='uhawh'><b id='uhawh'><form id='uhawh'><ins id='uhawh'></ins><ul id='uhawh'></ul><sub id='uhawh'></sub></form><legend id='uhawh'></legend><bdo id='uhawh'><pre id='uhawh'><center id='uhawh'></center></pre></bdo></b><th id='uhawh'></th></span></q></dt></tr></i><div id='uhawh'><tfoot id='uhawh'></tfoot><dl id='uhawh'><fieldset id='uhawh'></fieldset></dl></div>

    <tfoot id='uhawh'></tfoot>

      <small id='uhawh'></small><noframes id='uhawh'>

      <legend id='uhawh'><style id='uhawh'><dir id='uhawh'><q id='uhawh'></q></dir></style></legend>

          <bdo id='uhawh'></bdo><ul id='uhawh'></ul>

        如何使悬停在活动按钮上不使用悬停效果?

        时间:2023-11-30
          1. <tfoot id='lVml2'></tfoot>
                <bdo id='lVml2'></bdo><ul id='lVml2'></ul>

                <i id='lVml2'><tr id='lVml2'><dt id='lVml2'><q id='lVml2'><span id='lVml2'><b id='lVml2'><form id='lVml2'><ins id='lVml2'></ins><ul id='lVml2'></ul><sub id='lVml2'></sub></form><legend id='lVml2'></legend><bdo id='lVml2'><pre id='lVml2'><center id='lVml2'></center></pre></bdo></b><th id='lVml2'></th></span></q></dt></tr></i><div id='lVml2'><tfoot id='lVml2'></tfoot><dl id='lVml2'><fieldset id='lVml2'></fieldset></dl></div>

                <small id='lVml2'></small><noframes id='lVml2'>

                    <tbody id='lVml2'></tbody>
                  <legend id='lVml2'><style id='lVml2'><dir id='lVml2'><q id='lVml2'></q></dir></style></legend>
                  本文介绍了如何使悬停在活动按钮上不使用悬停效果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个对按钮具有悬停效果的导航栏.此外,每当页面处于活动状态时,该按钮的右侧都有一个边框,以显示它是当前打开的页面.基本上我想要的是活动按钮没有悬停效果,因为悬停效果覆盖了边框.

                  I have a navigation bar that has a hover effect for the buttons. Also whenever a page is active that button has a border on the right to show that it's the page that is currently open. Basically what I want is for the active button to not have a hover effect, because the hover effect covers up the border.

                  $(window).load(function() {
                      // Animate loader off screen
                      $(".loader").fadeOut("slow");;
                  });
                  
                  function homeTransition()
                  {   
                      $(this).toggleClass('activePage');
                  
                      if(document.getElementById("aboutContent").className.indexOf("slideInLeft") !== -1){
                          document.getElementById("aboutContent").className = " animated slideOutRight";
                      }
                      if(document.getElementById("projectsContent").className.indexOf("slideInUp") !== -1){
                          document.getElementById("projectsContent").className = " animated slideOutUp";
                      }
                      if(document.getElementById("contactContent").className.indexOf("slideInUp") !== -1){
                          document.getElementById("contactContent").className = " animated slideOutUp";
                      }
                      document.getElemenatById("al-saba").className = " animated bounceInDown";
                  }
                  
                  function aboutTransition()
                  {   
                      document.getElementById("al-saba").className = " animated bounceOutUp";
                      document.getElementById("aboutContent").style.visibility = "visible";
                      document.getElementById("aboutContent").className = "activePage animated slideInLeft";
                  
                      document.getElementById("projectsContent").className = " animated slideOutUp";
                      document.getElementById("contactContent").className = " animated slideOutUp";
                  }
                  
                  function projectsTransition()
                  {   
                      $(this).toggleClass('activePage');
                  
                      document.getElementById("al-saba").className = " animated bounceOutUp";
                      document.getElementById("projectsContent").style.visibility = "visible";
                      document.getElementById("projectsContent").className = "activePage animated slideInUp";
                  
                      document.getElementById("aboutContent").className = " animated slideOutRight";
                      document.getElementById("contactContent").className = " animated slideOutUp";
                  }
                  
                  function contactTransition()
                  {
                      $(this).toggleClass('activePage');
                  
                      document.getElementById("al-saba").className = " animated bounceOutUp";
                      document.getElementById("contactContent").style.visibility = "visible";
                      document.getElementById("contactContent").className = "activePage animated slideInUp";
                  
                      document.getElementById("aboutContent").className = " animated slideOutRight";
                      document.getElementById("projectsContent").className = " animated slideOutUp";
                  }
                  
                  //Menu
                  $(function() {
                      function expand() {
                          $(this).toggleClass("on");
                          $(".menu").toggleClass("active");
                      };
                  
                      $('.noselect').click(function() {
                          $('.noselect').removeClass('activePage');
                          $(this).toggleClass('activePage');
                      });
                  
                      $(".button").on('click', expand);
                  });

                  body {
                       font-family: "Source Sans Pro", sans-serif;
                       color: #ccc;
                       z-index: -100;
                       background-color: black;
                       overflow: hidden;
                       text-align: center;
                  }
                   .menu{
                       position: fixed;
                       top: 0;
                       left: 0;
                       bottom: 0;
                       padding: 0;
                       overflow: hidden;
                       background: rgba(0, 0, 0, 0.6);
                       width: 250px;
                       box-sizing: border-box;
                       transition: all 250ms;
                       -webkit-transform: translateZ(0) translateX(-100%);
                       transform: translateZ(0) translateX(-100%);
                       text-align:center;
                       box-shadow: 0 0 10px #000;
                  }
                   .active {
                       transform: translateZ(0) translateX(0);
                       transform: translateZ(0) translateX(0);
                       -webkit-transition: 0.4s;
                       transition: 0.4s;
                       color: #e5e5e5;
                  }
                   ul{
                       padding:0;
                       list-style:none;
                       font-size:14px;
                  }
                   li{
                      box-sizing: border-box;
                      -moz-box-sizing: border-box;
                      -webkit-box-sizing: border-box;
                       font-family: "Raleway";
                       width: 250px;
                       padding: 40px 5px;
                       color: #a7a7a7;
                       font-size: 1.8em;
                       font-weight: 300;
                       cursor: pointer;
                       transition: all .4s ease-in-out;
                  }
                   li:hover {
                       color: white;
                       background-color: #38d8b4;
                       -o-transition:.6s;
                       -ms-transition:.6s;
                       -moz-transition:.6s;
                       -webkit-transition:.6s;
                       transition:.6s;
                  }
                   .liSeperator {
                       width: 100%;
                       padding: 1px;
                       color: (0, 0, 0, .4);
                  }
                   .content {
                       position: relative;
                       width: 240px;
                  }
                   .button {
                       width:22px;
                       height:40px;
                       margin:80px 97px;
                       padding: 10px;
                       cursor:pointer;
                       transition: all .2s ease-in-out;
                  }
                   .button:hover{
                       transform: scale(1.2);
                  }
                   .line {
                       width: 40px;
                       height: 2px;
                       background-color:#fff;
                       transition: transform 0.3s ease, background 0.3s ease, opacity 0.3s ease, top 0.3s ease;
                  }
                   .line.first{
                       transform: translateX(-10px) translateY(22px) rotate(-90deg);
                  }
                   .line.second{
                       transform: translateX(-10px) translateY(19px) rotate(0deg);
                  }
                   .button.on .line.top{
                       width: 40px;
                       transform: translateX(-10px) translateY(20px) rotate(45deg);
                  }
                   .button.on .line.bottom{
                       width: 40px;
                       transform: translateX(-10px) translateY(17px)rotate(-45deg);
                  }
                   .activePage li {
                       transition: all .1s ease-in-out;
                       color: white;
                       border-right: 8px solid #38d8a1;
                  }

                  <div id="wrapper">
                                                      <div class="menu">
                                                          <h1 class="noselect">MENU</h1>
                                                          <ul>
                                                                  <li id="home" class="noselect" onclick="homeTransition()">
                                                                      <i class="fa fa-home"></i> home
                                                                  </li>
                                                              <div class="liSeperator"></div>
                                                                  <li id="about" class="noselect" onclick="aboutTransition()">
                                                                      <i class="fa fa-user"></i> about                                        
                                                                  </li>
                                                              <div class="liSeperator"></div>
                                                                  <li id="projects" class="noselect" onclick="projectsTransition()">
                                                                      <i class="fa fa-code"></i> projects
                                                                  </li>
                                                              <div class="liSeperator"></div>
                                                                  <li id="contact" class="noselect" onclick="contactTransition()">
                                                                      <i class="fa fa-paper-plane"></i> contact
                                                                  </li>
                                                          </ul>
                                                      </div>
                                                      <div class="content animated fadeInDown">
                                                          <div class="button">
                                                              <div class="line first top"></div>
                                                              <div class="line second bottom"></div>
                                                          </div>
                                                      </div>

                  推荐答案

                  正如@Pete 所说,您的 HTML 无效.但是您可以使用 :not():hover 选择器来排除 .activePage 类.

                  As @Pete said, your HTML is invalid. But you can exclude the .activePage class using :not() with your :hover selector.

                  所以用 .noselect:not(.activePage) li:hover

                  //Menu
                  $(function() {
                      function expand() {
                          $(this).toggleClass("on");
                          $(".menu").toggleClass("active");
                      };
                  
                      $('.noselect').click(function() {
                          $('.noselect').removeClass('activePage');
                          $(this).toggleClass('activePage');
                      });
                  
                      $(".button").on('click', expand);
                  });

                  body {
                    font-family: "Source Sans Pro", sans-serif;
                    color: #ccc;
                    z-index: -100;
                    background-color: black;
                    overflow: hidden;
                    text-align: center;
                  }
                  
                  .menu {
                    position: fixed;
                    top: 0;
                    left: 0;
                    bottom: 0;
                    padding: 0;
                    overflow: hidden;
                    background: rgba(0, 0, 0, 0.6);
                    width: 250px;
                    box-sizing: border-box;
                    transition: all 250ms;
                    -webkit-transform: translateZ(0) translateX(-100%);
                    transform: translateZ(0) translateX(-100%);
                    text-align: center;
                    box-shadow: 0 0 10px #000;
                  }
                  
                  .active {
                    transform: translateZ(0) translateX(0);
                    transform: translateZ(0) translateX(0);
                    -webkit-transition: 0.4s;
                    transition: 0.4s;
                    color: #e5e5e5;
                  }
                  
                  ul {
                    padding: 0;
                    list-style: none;
                    font-size: 14px;
                  }
                  
                  li {
                    box-sizing: border-box;
                    -moz-box-sizing: border-box;
                    -webkit-box-sizing: border-box;
                    font-family: "Raleway";
                    width: 250px;
                    padding: 40px 5px;
                    color: #a7a7a7;
                    font-size: 1.8em;
                    font-weight: 300;
                    cursor: pointer;
                    transition: all .4s ease-in-out;
                  }
                  
                  .noselect:not(.activePage) li:hover {
                    color: white;
                    background-color: #38d8b4;
                    -o-transition: .6s;
                    -ms-transition: .6s;
                    -moz-transition: .6s;
                    -webkit-transition: .6s;
                    transition: .6s;
                  }
                  
                  .liSeperator {
                    width: 100%;
                    padding: 1px;
                    color: (0, 0, 0, .4);
                  }
                  
                  .content {
                    position: relative;
                    width: 240px;
                  }
                  
                  .button {
                    width: 22px;
                    height: 40px;
                    margin: 80px 97px;
                    padding: 10px;
                    cursor: pointer;
                    transition: all .2s ease-in-out;
                  }
                  
                  .button:hover {
                    transform: scale(1.2);
                  }
                  
                  .line {
                    width: 40px;
                    height: 2px;
                    background-color: #fff;
                    transition: transform 0.3s ease, background 0.3s ease, opacity 0.3s ease, top 0.3s ease;
                  }
                  
                  .line.first {
                    transform: translateX(-10px) translateY(22px) rotate(-90deg);
                  }
                  
                  .line.second {
                    transform: translateX(-10px) translateY(19px) rotate(0deg);
                  }
                  
                  .button.on .line.top {
                    width: 40px;
                    transform: translateX(-10px) translateY(20px) rotate(45deg);
                  }
                  
                  .button.on .line.bottom {
                    width: 40px;
                    transform: translateX(-10px) translateY(17px)rotate(-45deg);
                  }
                  
                  .activePage li {
                    transition: all .1s ease-in-out;
                    color: white;
                    border-right: 8px solid #38d8a1;
                  }

                  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
                  <div id="wrapper">
                    <div class="menu">
                      <h1 class="noselect">MENU</h1>
                      <ul>
                        <div id="home" class="noselect" onclick="homeTransition()">
                          <li>
                            <i class="fa fa-home"></i> home
                          </li>
                        </div>
                        <div class="liSeperator"></div>
                        <div id="about" class="noselect" onclick="aboutTransition()">
                          <li>
                            <i class="fa fa-user"></i> about
                          </li>
                        </div>
                        <div class="liSeperator"></div>
                        <div id="projects" class="noselect" onclick="projectsTransition()">
                          <li>
                            <i class="fa fa-code"></i> projects
                          </li>
                        </div>
                        <div class="liSeperator"></div>
                        <div id="contact" class="noselect" onclick="contactTransition()">
                          <li>
                            <i class="fa fa-paper-plane"></i> contact
                          </li>
                        </div>
                      </ul>
                    </div>
                    <div class="content animated fadeInDown">
                      <div class="button">
                        <div class="line first top"></div>
                        <div class="line second bottom"></div>
                      </div>
                    </div>

                  这篇关于如何使悬停在活动按钮上不使用悬停效果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:响应式图像悬停 - CSS/JQuery 下一篇:悬停时背景颜色的渐变按钮闪烁

                  相关文章

                  <small id='6TrFV'></small><noframes id='6TrFV'>

                  <legend id='6TrFV'><style id='6TrFV'><dir id='6TrFV'><q id='6TrFV'></q></dir></style></legend>
                      <i id='6TrFV'><tr id='6TrFV'><dt id='6TrFV'><q id='6TrFV'><span id='6TrFV'><b id='6TrFV'><form id='6TrFV'><ins id='6TrFV'></ins><ul id='6TrFV'></ul><sub id='6TrFV'></sub></form><legend id='6TrFV'></legend><bdo id='6TrFV'><pre id='6TrFV'><center id='6TrFV'></center></pre></bdo></b><th id='6TrFV'></th></span></q></dt></tr></i><div id='6TrFV'><tfoot id='6TrFV'></tfoot><dl id='6TrFV'><fieldset id='6TrFV'></fieldset></dl></div>
                        <bdo id='6TrFV'></bdo><ul id='6TrFV'></ul>

                      <tfoot id='6TrFV'></tfoot>