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

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

        在 jQueryMobile 中触摸后悬停效果保持不变

        Hover effect stays after touch in jQueryMobile(在 jQueryMobile 中触摸后悬停效果保持不变)
        <legend id='Zug5F'><style id='Zug5F'><dir id='Zug5F'><q id='Zug5F'></q></dir></style></legend>

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

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

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

                  本文介绍了在 jQueryMobile 中触摸后悬停效果保持不变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 jQueryMobile 在 phonegap 中开发应用程序,仅适用于移动设备.我在其中搜索图标.当用户触摸它时,我想在该图标上赋予悬停效果.

                  I'm developiong application in phonegap with jQueryMobile for mobile devices only. In which I've search icon. I want to give hover effect on that icon when user touchs it.

                  我已经通过 css 实现了这一点:

                  I've achived this by css:

                  <a href="search.html" class="custom_header" >
                  
                      .custom_header:hover {
                          background:url('../images/effect_glow.png') no-repeat center;
                  

                  现在的问题是这种悬停效果在触摸后仍然存在.我想要mousein和mouseout这样的行为.在这种情况下,即使那部分没有接触,效果也会保持不变.

                  Now the problem is this hover effect stays after touch. I want behaviour like mousein and mouseout. In this case effect stays even that part is not touching.

                  手指离开后如何消除悬停效果?

                  How to remove hover effect after finger get off on it?

                  推荐答案

                  您可能知道这一点,但 :hover 在触摸屏设备上不存在.因此,当您设计一个响应式网站时,您应该仔细计划何时何地使用 :hover 交互.

                  You maybe know this but :hover doesn’t exist on touch screen devices. So when you design a responsive website, you should carefully plan when and where to use :hover interactions.

                  虽然它是在移动设备上实现的,但它的漏洞非常多,主要是在 iOS 设备上.另一方面,您不能使用 :focus,因为它只能用于支持焦点的元素,因此排除了标签和按钮.:active 也不适用于移动设备.

                  While it is implemented on mobile devices it is extremely buggy, mostly on iOS devices. On the other end you cant use :focus because it can be used only on a elements that support focus so a tags and buttons are ruled out. Also :active is no go on mobile devices.

                  在这种情况下,我们可以使用 jQuery 来解决这个问题.

                  In this case we can use jQuery to remedy this problem.

                  工作示例:http://jsfiddle.net/Gajotres/84Nug/

                  在这个例子中,我使用了 vmousedownvmouseupvmousecancel 事件,所以我可以在桌面/移动设备上测试它.只需将它们替换为 touchstarttouchendtouchcancel>.

                  In this example I have used vmousedown, vmouseup and vmousecancel events so I can test it on desktop / mobile devices alike. Just replace them with touchstart, touchend and touchcancel.

                  touchcancel/vmousecancel 是必需的,因为有时按钮可以保持按下状态.

                  touchcancel / vmousecancel is needed because sometimes button can stay in pressed state.

                  代码:

                  $(document).on('pagebeforeshow', '#index', function(){ 
                      $(document).on('touchstart','.custom_header' ,function(){
                          $(".custom_header").css("background","url('http://www.cesarsway.com/sites/default/files/cesarsway-images/features/2012/March/Puppies-and-Exercise.jpg') no-repeat center");
                      }).on('touchend', function(){
                          $(".custom_header").css("background","red");
                      }).on("touchcancel", function() {
                          $(".custom_header").css("background","red");
                       }); 
                  });
                  

                  这篇关于在 jQueryMobile 中触摸后悬停效果保持不变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  在开发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)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)
                  getFullYear returns year before on first day of year(getFullYear 在一年的第一天返回前一年)

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

                    <small id='2YrS4'></small><noframes id='2YrS4'>

                      <tfoot id='2YrS4'></tfoot>
                      1. <legend id='2YrS4'><style id='2YrS4'><dir id='2YrS4'><q id='2YrS4'></q></dir></style></legend>