Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- use:
- javascript:hJump( 'yourrowid' , 'https://www.yourdomain.com/yourlink' );
- as the link target/href
- */
- function hJump( id , link ) {
- if ( history.pushState ) {
- let newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + ( window.location.search ? window.location.search : '' ) + '#' + id ;
- window.history.pushState({path:newurl},'',newurl);
- }
- window.location.href = link ;
- }
- jQuery( "#results a" ).click( function( event ){
- // prevent from going to the link before we want it to
- event.preventDefault();
- // reference the dom-element
- $this = jQuery( this );
- // set history and jump away!
- hJump( 'result', $this.attr('href') );
- } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement