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

        <bdo id='a32WB'></bdo><ul id='a32WB'></ul>
    1. <small id='a32WB'></small><noframes id='a32WB'>

      1. <legend id='a32WB'><style id='a32WB'><dir id='a32WB'><q id='a32WB'></q></dir></style></legend>
      2. 在悬停时用另一个替换一个 div

        replace one div with another on hover(在悬停时用另一个替换一个 div)

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

          • <bdo id='ppafz'></bdo><ul id='ppafz'></ul>
          • <tfoot id='ppafz'></tfoot>

            <legend id='ppafz'><style id='ppafz'><dir id='ppafz'><q id='ppafz'></q></dir></style></legend>
              • <i id='ppafz'><tr id='ppafz'><dt id='ppafz'><q id='ppafz'><span id='ppafz'><b id='ppafz'><form id='ppafz'><ins id='ppafz'></ins><ul id='ppafz'></ul><sub id='ppafz'></sub></form><legend id='ppafz'></legend><bdo id='ppafz'><pre id='ppafz'><center id='ppafz'></center></pre></bdo></b><th id='ppafz'></th></span></q></dt></tr></i><div id='ppafz'><tfoot id='ppafz'></tfoot><dl id='ppafz'><fieldset id='ppafz'></fieldset></dl></div>
                    <tbody id='ppafz'></tbody>
                  本文介绍了在悬停时用另一个替换一个 div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当鼠标悬停在一个 div 上时,我想用另一个 div 替换它.具体来说会有一个平均的话,比如苦苦挣扎"或者超出预期",我想当用户将鼠标悬停在文字平均数上时,用数值平均代替.

                  I want to replace one div with another when hovering over it. Specifically there will be an average in words, such as "struggling" or "exceeding expectations", and I want to replace this with the numerical average when the user hovers over the average in words.

                  #html
                  
                  <div class="switch avg_words float_left">
                    A+ (hover to see score)  
                  </div>
                  <div class="avg_num">
                    AVG = 98.35%
                  </div>
                  
                  #css
                  
                  .avg_num {
                  display: none;
                  }
                  
                  #jquery
                  
                  $('.switch').hover(function() {
                      $(this).closest('.avg_words').hide();
                      $(this).next('div').closest('.avg_num').show();
                  }, function() {
                      $(this).next('div').closest('.avg_num').hide();
                      $(this).closest('.avg_words').show();
                  });
                  

                  隐藏第一个 div 并用第二个 div 替换它很容易,但问题在于当悬停结束时将事情恢复正常的代码.现在悬停时,div 只是在彼此之间来回闪烁.

                  It's easy enough to hide the first div and replace it with the second, but the trouble is with the code to set things back to normal when hover ends. Now on hover, the divs just blink back and forth between each other.

                  http://jsfiddle.net/uXeg2/1/

                  推荐答案

                  将 switch 类移动到外部 div,像这样

                  Move the switch class to an outter div, like so

                  <div class="switch">
                  <div class="avg_words float_left">
                    A+ (hover to see score)  
                  </div>
                  <div class="avg_num">
                    AVG = 98.35%
                  </div>
                  </div>
                  
                  $('.switch').hover(function() {
                          $(this).find('.avg_words').hide();
                          $(this).find('.avg_num').show();
                      }, function() {
                          $(this).find('.avg_num').hide();
                          $(this).find('.avg_words').show();
                  });
                  

                  更新的小提琴:http://jsfiddle.net/uXeg2/2/

                  这篇关于在悬停时用另一个替换一个 div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href
                  quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
                  How do I make a TextGeometry multiline? How do I put it inside a square so it wraps like html text does inside a div?(如何制作 TextGeometry 多线?如何将它放在一个正方形内,以便它像 html 文本一样包裹在 div 内?) - IT屋-程序员软件开发技术分享社
                  ExecJS::ProgramError: SyntaxError: Reserved word quot;functionquot;(ExecJS::ProgramError: SyntaxError: 保留字“function)
                  Infinite scroll and will_paginate appending the #39;next page#39; of items multiple times(无限滚动和 will_paginate 多次附加项目的“下一页)
                  What is cleanest way to turn Array of JQuery Promises into a JQuery Promise of an Array?(将 JQuery Promise 数组转换为数组的 JQuery Promise 的最简洁方法是什么?)
                  <legend id='7dSGb'><style id='7dSGb'><dir id='7dSGb'><q id='7dSGb'></q></dir></style></legend>
                    <tbody id='7dSGb'></tbody>
                    1. <tfoot id='7dSGb'></tfoot>
                      <i id='7dSGb'><tr id='7dSGb'><dt id='7dSGb'><q id='7dSGb'><span id='7dSGb'><b id='7dSGb'><form id='7dSGb'><ins id='7dSGb'></ins><ul id='7dSGb'></ul><sub id='7dSGb'></sub></form><legend id='7dSGb'></legend><bdo id='7dSGb'><pre id='7dSGb'><center id='7dSGb'></center></pre></bdo></b><th id='7dSGb'></th></span></q></dt></tr></i><div id='7dSGb'><tfoot id='7dSGb'></tfoot><dl id='7dSGb'><fieldset id='7dSGb'></fieldset></dl></div>

                          <small id='7dSGb'></small><noframes id='7dSGb'>

                          • <bdo id='7dSGb'></bdo><ul id='7dSGb'></ul>