English 中文(简体)
JQuery的 h权高于 mo权的任何好处?
原标题:Any advantages of hover over mouseover in JQuery?
  • 时间:2010-05-18 18:48:31
  •  标签:
  • jquery

I am fairly new to JQuery API. I have been using mouseover, but I have never used hover before. SO I am wondering if I should use hover instead.

最佳回答

Well, .hover() http://api.jquery.com/mouseenter” rel=“nofollow noretinger”>mouseleave,因此这是一种更方便的方式,也更容易理解目的。

mouseenter differs from mouseover so far as mouseenter is not fired if the cursor is over/enters a child element of the element the handler is bound to.
It is only fired once, when the cursors enters the element. mouseover is always fired, even if the cursor is over a child element.

了解差异的最佳途径是查看mouseleave(

此外,mouseovermouseout均为真正的 Java本,而mouseenter<>和>mouseleave<>/code>为j Query(afaik)提供的活动。

www.un.org/Depts/DGACM/index_spanish.htm 最后,这取决于你想要达到的目标。 没有任何权利或错误,所有这些方法都有其目的。 除非你显示某些法典,否则就更不用说。


如果你指“:hover in CSS,而且你可以达到预期效果,就去做。 如果对某些问题有一个非司法解决办法,则总是选择这一问题。

问题回答

只是为了节省你们在一种功能中做两件工作:mouseentermouseleave

i 更喜欢使用笼罩,因为似乎我用手法较少做。

他们也一样,只有 h子和 mo子处理。

。 http://api.jquery.com/hover/

因此,你可以照此使用。

$( selector ).hover(function () {
    // Do stuff on mouse enter
  }, function () {
    // Do other stuff on mouse leave
  }
)

既然你正在学习,这里就等于使用 h:

$( selector ).bind( mouseenter mouseleave , function(){
 if (event.type == "mouseenter") {
  // MouseEnter code
 } else {
  // MouseLeave code
 }
})




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...