• <small id='UG9nL'></small><noframes id='UG9nL'>

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

        <tfoot id='UG9nL'></tfoot>
          <bdo id='UG9nL'></bdo><ul id='UG9nL'></ul>
      1. 如何在启用触摸的浏览器中模拟悬停?

        How do I simulate a hover with a touch in touch enabled browsers?(如何在启用触摸的浏览器中模拟悬停?)

      2. <small id='ZTNZ5'></small><noframes id='ZTNZ5'>

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

                  <tfoot id='ZTNZ5'></tfoot>
                  本文介绍了如何在启用触摸的浏览器中模拟悬停?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  使用一些像这样的 HTML:

                  With some HTML like this:

                  <p>Some Text</p>
                  

                  然后是这样的一些 CSS:

                  Then some CSS like this:

                  p {
                    color:black;
                  }
                  
                  p:hover {
                    color:red;
                  }
                  

                  如何允许在支持触控的设备上长按来复制悬停?我可以更改标记/使用 JS 等,但想不出一个简单的方法来做到这一点.

                  How can I allow a long touch on a touch enabled device to replicate hover? I can change markup/use JS etc, but can't think of an easy way to do this.

                  推荐答案

                  好的,我已经解决了!它涉及稍微更改 CSS 并添加一些 JS.

                  OK, I've worked it out! It involves changing the CSS slightly and adding some JS.

                  使用jQuery让它变得简单:

                  Using jQuery to make it easy:

                  $(document).ready(function() {
                      $('.hover').on('touchstart touchend', function(e) {
                          e.preventDefault();
                          $(this).toggleClass('hover_effect');
                      });
                  });
                  

                  英文:开始或结束触摸时,打开或关闭类hover_effect.

                  In english: when you start or end a touch, turn the class hover_effect on or off.

                  然后,在您的 HTML 中,将类悬停添加到您希望它使用的任何内容.在您的 CSS 中,替换以下任何实例:

                  Then, in your HTML, add a class hover to anything you want this to work with. In your CSS, replace any instance of:

                  element:hover {
                      rule:properties;
                  }
                  

                  element:hover, element.hover_effect {
                      rule:properties;
                  }
                  

                  为了增加实用性,请将其添加到您的 CSS 中:

                  And just for added usefulness, add this to your CSS as well:

                  .hover {
                  -webkit-user-select: none;
                  -webkit-touch-callout: none;        
                  }
                  

                  停止浏览器要求您复制/保存/选择图像或其他任何内容.

                  To stop the browser asking you to copy/save/select the image or whatever.

                  简单!

                  这篇关于如何在启用触摸的浏览器中模拟悬停?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  ChartJS Version 3 - common legend for multiple line charts(ChartJS 版本 3 - 多个折线图的常用图例)
                  Charts.js scales yaxes ticks min max doesnt work(Charts.js 缩放 yaxes 刻度 min max 不起作用)
                  How to expand the slice of donut chart in chartjs?(如何在chartjs中扩展圆环图的切片?)
                  Chart.js yAxes Ticks stepSize not working (fiddle)(Chart.js yAxes Ticks stepSize 不起作用(小提琴))
                  Rounded corners on chartJS v.2 - bar charts (with negative values)(chartJS v.2 上的圆角 - 条形图(带负值))
                  How to hide value in Chart JS bar(如何在 Chart JS 栏中隐藏值)
                  <tfoot id='XfAq7'></tfoot>
                    <i id='XfAq7'><tr id='XfAq7'><dt id='XfAq7'><q id='XfAq7'><span id='XfAq7'><b id='XfAq7'><form id='XfAq7'><ins id='XfAq7'></ins><ul id='XfAq7'></ul><sub id='XfAq7'></sub></form><legend id='XfAq7'></legend><bdo id='XfAq7'><pre id='XfAq7'><center id='XfAq7'></center></pre></bdo></b><th id='XfAq7'></th></span></q></dt></tr></i><div id='XfAq7'><tfoot id='XfAq7'></tfoot><dl id='XfAq7'><fieldset id='XfAq7'></fieldset></dl></div>
                      <tbody id='XfAq7'></tbody>
                    <legend id='XfAq7'><style id='XfAq7'><dir id='XfAq7'><q id='XfAq7'></q></dir></style></legend>

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

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