colors - JQuery navigation menu -


var navobject = { padleft : '20px', padlefthover : '40px', goright : function(obj){     if (!obj.parent('li').hasclass('active')) {         obj.stop(true, true).animate({ 'padding-left' : this.padlefthover }, 'fast');     } }, goleft : function(obj){     if (!obj.parent('li').hasclass('active')) {             obj.stop(true, true).animate({ 'padding-left' : this.padleft }, 'fast');     } }, makeactive : function(obj) {     obj.siblings().each(function() {         if($(this).hasclass('active')) {             $(this).removeclass('active');             navobject.goleft($(this).children('a'));         }     });     if (!obj.hasclass('active')) {          obj.addclass('active');     } }  }$(function() { $('#navigation li a').hover(function() {     navobject.goright($(this));     $(this).css({     "color": "red",      "position": "relative",     "font-size": "20px"}); }, function() {     navobject.goleft($(this));     $(this).css({     "color": "yellow",     "font-size": "14px"}); });  $('#navigation li a').click(function() {     navobject.makeactive($(this).parent('li'));     navobject.goright($(this));     return false; });}); 

hi.. have jquery codes , i'm doing here vertical navigation bar in website

my prob is, when hover navigation menu css in codes. when click menu, want text stay red. not go yellow..

thanks time helping me out .. ^_^

so, click first, sets red. then mouseout, set text yellow. suggest use classes. on click, add class, on hover (mousein/mouseout), add , remove different class. way, when click, click color "stick."


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -