如何删除jQuery Mobile中的悬停延迟? [英] How can I remove the hover delay in jQuery Mobile?

查看:75
本文介绍了如何删除jQuery Mobile中的悬停延迟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery Mobile建立一个网站.当我将鼠标悬停在按钮上时,它会更改其类(并通过扩展来更改其颜色),但感觉需要半秒钟左右的时间.有没有办法减少这种延迟?

I'm making a website with jQuery Mobile. When I hover over a button, it changes its class (and by extension, its color), but it feels like it takes half a second or so to do so. Is there a way to reduce this delay?

推荐答案

您可以覆盖hoverDelay而无需修改jQuery Mobile js库.要更改默认值(全局设置),您需要收听mobileinit并进行更改.

You can override hoverDelay without modifying jQuery Mobile js library. To change defaults (global settings), you need to listen to mobileinit and do your changes.

请注意,以下代码应放在jQuery核心之后和jQuery Mobile库之前.

Note that the below code should be placed in head after jQuery core and before jQuery Mobile libraries.

<script src="jquery.js"></script>
<script>
   $(document).on("mobileinit", function () {
      $.mobile.buttonMarkup.hoverDelay = 0;
   });
</script>
<script src="jquery-mobile.js"></script>

这篇关于如何删除jQuery Mobile中的悬停延迟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆