Recently, project development is very busy, one of the requirements is to achieve responsive navigation. (Response-style questions we communicate in CSS-related blogs)
Everyone knows that navigation needs to be down to the menu effect, and will inevitably use the hover () method of jquery. If the navigation is on the ipad, the natural hover () is meaningless. How do I cancel the hover () and add the touch event?
Today, jquery needs to remove the hover of the problem, the original thought of direct unbind ("hover") can be done, but the half-day error.
The reason is really simple, hover is not an event. Open the reference manual, hover is actually composed of MouseEnter and MouseLeave. This is a very clear question!
/*this method is wrong.*/$ (#hover_div). Unbind ("Hover");/*This method is also wrong.*/$ (#hover_div). Unbind ("mouseover"). Unbind ("Mouseout");/*This method is new and cannot be used in the old version .*/$ (#hover_div). Unbind ("MouseEnter MouseLeave");/*This method is correct, both the old and new versions are available*/$ (#hover_div). Unbind ("MouseEnter"). Unbind ("MouseLeave");
The code above suggests the use of a fourth, relatively safe. (I did not test the specific version to support the third method) if you feel uncomfortable, you just download the new version of jquery, use the Third Kind!
Anyway, the problem is solved, then write the code! Industrious yards of farming.