场景:
/node/1
/node/2
已加载这是为了提高可用性,因为我们的页面很长,但我找不到解决方案。
这使用 localstorage 来记住最后点击的链接的 id: http://jsfiddle.net/nf6s43ht/1/
if(localStorage['lastclick']===undefined){
console.log('undefined')
}else{
$('#'+localStorage['lastclick']).focus()//focus the <a>
}
$('a').click(function(){
localStorage['lastclick']=$(this).attr('id')//memorize id
})