Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to hold(and show) the current 'a' element when you put 'history.back()' that you clicked just a moment ago
    text
    copied!<p>in this page <a href="http://api.jquery.com/category/effects/" rel="nofollow noreferrer">http://api.jquery.com/category/effects/</a></p> <p>when you put 'up'(keyboard) and 'down',then put 'enter',it will go to the current url,</p> <p>and when you put 'backspace'</p> <p>it will always show the same 'li' element you put 'enter'.</p> <p>how to set this.</p> <p>this is my code:</p> <pre><code> shortcut.add("up",function(e) { var a=$('#start &gt; div:first-child'); var b=$('#start &gt; div.live')[0]; var c=$('#start &gt; div:last-child'); if(b==a[0]){ b=$(b); b.removeClass('live'); c.addClass('live'); b=c; } else if(b){ b=$(b); b.removeClass('live'); b.prev().addClass('live'); } else{ b=$(b); a.addClass('live') } // var a=$('#start &gt; div.live a')[0]; a.focus(); a.focus(function(){ this.parent().parent().addClass('live'); }) // var currentHeight = b.outerHeight(), offset = b.prev().offset(); //alert(currentHeight+' '+offset.top) var _targetScrollTop = Math.round( offset.top - currentHeight - ($(window).height()/3) ); //$('html,body').animate({ scrollTop: _targetScrollTop }, 100); $('html,body').scrollTop(_targetScrollTop); // }); shortcut.add("down",function(e) { var a=$('#start &gt; div:first-child'); var b=$('#start &gt; div.live')[0]; var c=$('#start &gt; div:last-child'); if(c[0]==b){ b=$(b); b.removeClass('live'); a.addClass('live'); } else if(b){ b=$(b); b.removeClass('live'); b.next().addClass('live'); }else{ a.addClass('live'); } // var a=$('#start &gt; div.live a')[0]; a.focus(); a.focus(function(){ this.parent().parent().addClass('live'); }) // if(!b)return; var currentHeight = b.outerHeight(), offset = b.next().offset(); //alert(currentHeight+' '+offset.top) var _targetScrollTop = Math.round( offset.top - currentHeight - ($(window).height()/3) ); //$('html,body').animate({ scrollTop: _targetScrollTop }, 100); $('html,body').scrollTop(_targetScrollTop); // }) } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload