javascript - Active link background -


i trying keep background image active link , hover navigational bar on site

sitelink: http://67.23.226.231/~edutubei/onepage/#about

using below code

$(document).ready(function() {   $('#navigation a[href^="#' + location.pathname.split("#")[1] + '"]').addclass('current');  });  

with below css

ul.navigation .current{   background:url(../images/current_page.png) no-repeat right bottom; }     ul.navigation .current a, ul.navigation .current a:hover{   color:#fff; } 

but not working how can keep background image/highlight active , hover links

your selector not right. should '.navigation' in place of '#navigation'

the location.pathname returns /~edutubei/onepage/. got use window.location.href instead.

 $('.navigation a[href="#' + window.location.href.split("#")[1] + '"]').addclass('current'); 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -