:悬停选择器不适用于jQuery 1.4 [英] :hover selector doesn't work with jQuery 1.4

查看:80
本文介绍了:悬停选择器不适用于jQuery 1.4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用Google搜索 - 没有发现任何东西。
我在谈论CSS:悬停,而不是jQuery .hover()。
所以,代码:

  $('#something a:hover')。css({'something' :'thomesing'}); 

适用于1.3 ,但不适用于1.4。如何解决?

解决方案

hover 在1.4中更改并且搞笑否一个人似乎已经费心去查看jQuery文档...

  $(#something a)。hover(
function(){
$(this).toggleClass(active)
}
);

通过css更改颜色。



注意:

调用 $(选择器).hover(handlerInOut)是简写:

  $(selector).bind(mouseenter mouseleave,handlerInOut); 


Googled about it - found nothing. I'm talking about CSS :hover, not jQuery .hover(). So, the code:

$('#something a:hover').css({'something': 'thomesing'});

works fine with 1.3, but not with 1.4. How to fix it?

解决方案

hover changed in 1.4 and funny no one here seems to have bothered checking the jQuery docs...

$("#something a").hover(
  function () {
    $(this).toggleClass("active")
  }
);

Change the colors via css.

Note:
Calling $(selector).hover(handlerInOut) is shorthand for:

$(selector).bind("mouseenter mouseleave",handlerInOut);

这篇关于:悬停选择器不适用于jQuery 1.4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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