mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FIX: Linking to relative hash URLs was reloading the app.
This commit is contained in:
parent
f44bd4ec28
commit
2cf6f65660
1 changed files with 11 additions and 0 deletions
|
@ -57,6 +57,17 @@ Discourse.URL = Em.Object.createWithMixins({
|
|||
return;
|
||||
}
|
||||
|
||||
// Scroll to the same page, differnt anchor
|
||||
if (path.indexOf('#') === 0) {
|
||||
var $elem = $(path);
|
||||
if ($elem.length > 0) {
|
||||
Em.run.schedule('afterRender', function() {
|
||||
$('html,body').scrollTop($elem.offset().top - $('header').height() - 15);
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var oldPath = window.location.pathname;
|
||||
path = path.replace(/(https?\:)?\/\/[^\/]+/, '');
|
||||
|
||||
|
|
Loading…
Reference in a new issue