jquery Event Switch Hover/toggle

Source: Internet
Author: User

1.hover ([Over,]out)

A method that mimics the hover event (moving the mouse over an object and moving out of the object). This is a custom method that provides a "keep in" state for frequently used tasks.

The first function that is specified is triggered when the mouse moves over a matching element. When the mouse moves out of this element, the specified second function is triggered. Also, it is accompanied by detection of whether the mouse is still in a particular element (for example, an image in a div), and, if so, continues to remain in a "hover" state without triggering a move-out event (fixed a common error using the Mouseout event).

Parameters:

Over: The mouse moves to the function to be triggered on the element

Out: The mouse moves out of the element to trigger the function

Instance:

$("td").hover(  function () {    $(this).addClass("hover");  },  function () {    $(this).removeClass("hover");  });
2.toggle([speed],[easing],[fn])

Used to bind two or more event handler functions in response to a rotating click event of the selected element.

If the element is visible, toggle to hidden, or toggle to visible if the element is hidden.

Parameters:

Speed: Hides/shows how fast the effect is. The default is "0" milliseconds. Possible values: Slow,normal,fast. "

Easing: (Optional) is used to specify the toggle effect, the default is "Swing", the available parameters "linear"

fn: The function that executes when the animation is complete, once for each element.

Instance:

$("td").toggle(  function () {    $(this).addClass("selected");  },  function () {    $(this).removeClass("selected");  });
 

jquery Event Switch Hover/toggle

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.