我有一个jQuery动画菜单,但是当我点击一个项目(菜单点)时,该网站会重新加载一个节目内容和菜单的第一个视图,但没有选择的菜单项。
如何在重新加载后激活项目并打开所选的ul?
$('a.forward').next().hide();
/* Forward Button */
$('a.forward').click(function(e) {
e.preventDefault();
$(this).next().clone(true, true).appendTo(".subnav").css({
position: "absolute",
left:"190px",
top:"0",
display:"block"}).animate({
left:"0"
}, 300);
$(this).closest("ul").animate({
left:"-190px",
}, 300);
return false;
});
/* Back Button */
$('a.back').click(function(e) {
e.preventDefault();
$(this).closest("ul").prev().animate({
left:"0",
}, 300);
$(this).closest("ul").animate({
left:"200px",
}, 300, "linear",function(){$(this).remove()});
return false;
});
var targetAnchor;
$.each ($('ul.lsb-menu a'), function() {
if( this.href == window.location ) {
targetAnchor = this;
return false;
}
});
var parent = $(targetAnchor).closest('li');
while(true) {
parent.addClass('active');
if( $(parent).parents('ul.lsb-menu').length <= 0 ) break;
}