jQuery active menu issue
I have tried to implement this jQuery active menu code: http://docs.jquery.com/Tutorials:Auto-Selecting_Navigation
$(function(){
var path = location.pathname.substring(1);
if ( path )
$('#sidebar_content a[@href$="' + path + '"]').attr('class', 'selected');
});
but it does 开发者_开发百科not seem to be adding the class: http://www.thecreativealliance.org/gallery/advertising-and-marketing?CategoryID=39196&cat=Promotions%20%26%20publicity
Any ideas?
Jack
Try .addClass('selected')
(documentation) and change the query: #sidebar_content a[href="' + ...
(@ and $ aren't needed).
JQuery API doc is highly recommended, to keep in mind the available methods.
精彩评论