He took a screenshot for me, which is the category menu of QQ Mall. The effect is as follows:
I took a look, eh! Our blog park is also like this! I have never done this effect myself before, so I just wanted to try it myself! (I'm not an artist, but I know a little bit about js!)
1. Analysis:
1. The big category on the right must be represented by divMenuContent under a layer
2. The one on the left that the mouse moves up should be It is also a layer, below it is represented by divMenuItem
Question: How to express it as shown in the picture? The left and right sides look like one piece! So I thought that the right side of divMenuItem is none, and the z-axis is higher than divMenuContent, so that it just presses on the border of divMenuContent!
The following are the styles of the two layers:
Simply set the style of the menu:
Copy the code
padding:0px;
Copy code
$("# divMenuItem")
Copy code
if($(e.toElement).parent().attr("id") !="menu" && $(e.toElement).attr("id")!="divMenuContent")
There is a comment inside, the offset() piece, it and the offset() below are two effects, the current rendering:
Change the comment section to the rendering:
The effect has been tested in: IE6, 7, 8, and chrome!
Code package download/201011/yuanma/menu_jquery1.rar