Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. function removeHash () {
  2. var scrollV, scrollH, loc = window.location;
  3. if ("pushState" in history)
  4. history.pushState("", document.title, loc.pathname + loc.search);
  5. else {
  6. // Prevent scrolling by storing the page's current scroll offset
  7. scrollV = document.body.scrollTop;
  8. scrollH = document.body.scrollLeft;
  9.  
  10. loc.hash = "";
  11.  
  12. // Restore the scroll offset, should be flicker free
  13. document.body.scrollTop = scrollV;
  14. document.body.scrollLeft = scrollH;
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement