• <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.

                  简单!

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

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

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)
                  <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>