menu - munu with jQuery but could not highlighte item as actived -


works as menus and submenus within code href = #, but href = domain.com / Index / Id / 12

------------ JS

  $ (function ( } {$ ('. Menu1 a'). (Function (i) {if ($ (this) .attr ('class') == 'this' || $ (this) .attr ('class') = = 'This hover') {$ ('menu2'). Eq (i) Show ();} $ (this). Click (function () {/ * mousemove * / $ ('. Menu1 a') RemoveClass ('this'); $ (this). Andclass ('this'); $ ('. Menu2'). Skip (); $ ('menu2'). Eq (i) .show ();} );});});   

---------- Menu

  & lt; Div class = "menu" & gt; & Lt; Div class = "menu 1" & gt; & Lt; One square = "this" href = "javascript:;" & Gt; About & lt; / A & gt; & Lt; A href = "javascript:;" & Gt; Contact & lt; / A & gt; & Lt; a href = "www.domain.com/index/id/12" & gt; Help & lt; / A & gt; (If selected, is not highlighted) & lt; A href = "javascript:;" & Gt; Other & lt; / A & gt; & Lt; / Div & gt; & Lt; Div class = "menu 2" & gt; & Lt; a href = "www.domain.com/index/product" & gt; ASP & lt; / A & gt; (Same submenu as above) & lt; A href = "javascript:;" & Gt; PHP & lt; / A & gt; & Lt; A href = "javascript:;" & Gt; CGI & lt; / A & gt; & Lt; / Div & gt; & Lt; Div class = "menu 2" & gt; & Lt; A href = "javascript:;" & Gt; SQL & lt; / A & gt; & Lt; A href = "javascript:;" & Gt; CSS & lt; / A & gt; & Lt; A href = "javascript:;" & Gt; Efg & lt; / A & gt; & Lt; A href = "javascript:;" Gt; google & lt; / A & gt; & Lt; A href = "javascript:;" & Gt; Some & lt; / A & gt; & Lt; / Div & gt; & Lt; / Div & gt;   

---------- CSS

 . Menuu1 {Height: 30px; Background: #CCCCCC;} / * # 1B75C4 * /. Menuu1A {display: inline; Float: left; Height: 30px; Line-height: 30px; Color: #fff; Margin: 0 5px; Padding: 0 5px;}. Menu 1a: hover, .menu1 a.this, .menu1 a.hover {background: #fff; Color: # 333;}. Menu 2 {height: 30px; Display: None;} Menu 2. A {display: inline; Float: left; Height: 30px; Line-height: 30px; Margin: 0 5px; Padding: 0 5px; }. Menuu2 a: hover {color: # 1B75C4;}   

Thanks for any help.

------------- Thanks for any help

Try to use to stop the default click action of your anchor:

  $ (this) .click (function (e) $ '('. Menu1a '). RemoveClass (' this'); $ (This) .addClass ('this'); $ (' menu2 ') Hide ( ); $ ('Menu2'). Eq (i) .show ();});    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -