Make fragment identifiers work with base


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /**
  2.  * Make fragment identifiers work with base
  3.  */
  4. jQuery(function($) {
  5. $("a[href^=#]").click(function(e) {
  6. e.preventDefault();
  7. window.location.hash = this.href.substr(this.href.indexOf("#") + 1);
  8. });
  9. });
  10.  
  11.  
  12.  
  13.  
  14. /**
  15.  * Make fragment identifiers work with base and jqueryui-tabs
  16.  */
  17. jQuery(function($) {
  18. $("a[href^=#]").not(".ui-tabs-nav a").click(function(e) {
  19. e.preventDefault();
  20. window.location.hash = this.href.substr(this.href.indexOf("#") + 1);
  21. })
  22. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.