mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-08-07 10:01:47 -04:00
Refine anchors
This commit is contained in:
parent
e8daf15480
commit
261e65d918
@ -333,15 +333,27 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||||
var target = $(e.target).attr("href") // activated tab
|
|
||||||
if (history.pushState) {
|
|
||||||
history.pushState(null, null, target);
|
|
||||||
}
|
|
||||||
if (isStorageSupported() && /\/settings\//.test(location.href)) {
|
if (isStorageSupported() && /\/settings\//.test(location.href)) {
|
||||||
localStorage.setItem('last:settings_page', location.href);
|
var target = $(e.target).attr("href") // activated tab
|
||||||
|
if (history.pushState) {
|
||||||
|
history.pushState(null, null, target);
|
||||||
|
}
|
||||||
|
localStorage.setItem('last:settings_page', location.href.replace(location.hash, ''));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// set timeout onDomReady
|
||||||
|
setTimeout(delayedFragmentTargetOffset, 500);
|
||||||
|
|
||||||
|
// add scroll offset to fragment target (if there is one)
|
||||||
|
function delayedFragmentTargetOffset(){
|
||||||
|
var offset = $(':target').offset();
|
||||||
|
if (offset) {
|
||||||
|
var scrollto = offset.top - 180; // minus fixed header height
|
||||||
|
$('html, body').animate({scrollTop:scrollto}, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user