Left-side category navigation menu (continued)

Source: Internet
Author: User

The left-side category navigation menu is the most direct category of E-commerce shopping navigation.

Main points of attention in js:
1. events include mouseover and mouseleave.
The onmouseover event occurs when the mouse pointer moves to the specified object.
The onmouseleave event occurs when the mouse pointer is removed from the specified object.
2. setTimeout and clearTimeout
The setTimeout method is used to call a function or computing expression after a specified number of milliseconds. SetTimeout () is executed only once.
The clearTimeout method can cancel the timeout set by the setTimeout () method.

Code snippet:
The action taken when the mouse moves to the li element and removes the element.

_this.showlist.find(".item").live("mouseover", $ = $(), show = _this.showlist.find(".show"), len =(!!(!!=  setTimeout(".show,.tri"".tit").removeClass("on" index = $.index(),tmpheight = $.find(".show").height(),topval = 0(index < 5= index * (-41"top": topval + "px" (index > ( len - 5= -tmpheight + (len - 1 -index) * 41 + 20"top": topval + "px" tmpheight = $.find(".show"= -tmpheight/2 + 10;            show.css({"top": topval + "px".find(".show,.tri".find(".tit").addClass("on"".item").live("mouseleave", $ = $(= setTimeout(.find(".show,.tri".find(".tit").removeClass("on"

 


Pay attention to css
1. position: Use of relative and position
2. Clear floating
3. Use of hover pseudo classes


Code Demonstration:

If the settings are displayed, "navSwitch": "navopen" is hidden by default.

The default effect is as follows:

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.