Skip to content
Snippets Groups Projects
Commit 9b3e0389 authored by Mark M. Florida's avatar Mark M. Florida
Browse files

Update for hashchange event to handle multiple hash parts - necessary to...

Update for hashchange event to handle multiple hash parts - necessary to select a tab when page is loaded via ajax using the url hash.
parent a0501875
No related branches found
No related tags found
No related merge requests found
...@@ -37,12 +37,26 @@ ...@@ -37,12 +37,26 @@
<script> <script>
XNAT.app.customPage.container = $('#view-page'); (function(){
XNAT.app.customPage.getPage();
window.onhashchange = function(){ var sampleUrl = '/page/#/foo/#tab=bar/#panel=baz'
XNAT.app.customPage.getPage();
} // save the value for the initial page that's loaded
var page = getUrlHashValue('#/', '/#');
XNAT.app.customPage.container = $('#view-page');
XNAT.app.customPage.getPage(['', '/#']);
$(window).on('hashchange', function(e){
e.preventDefault();
var newPage = getUrlHashValue('#/', '/#');
// only get a new page if the page part has changed
if (newPage !== page) {
XNAT.app.customPage.getPage([newPage, '/#']);
}
})
})();
</script> </script>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment