Skip to content
Snippets Groups Projects
Unverified Commit 1c5e7d27 authored by Chris Lawton's avatar Chris Lawton Committed by GitHub
Browse files

Merge pull request #429 from OpenTechFund/feature/264-add-tab-url-hash

append tab hash to url
parents 05aba2de 01c5d9ed
No related branches found
No related tags found
No related merge requests found
...@@ -43,11 +43,10 @@ class Tabs { ...@@ -43,11 +43,10 @@ class Tabs {
tabs(e) { tabs(e) {
// Find current tab // Find current tab
this.stripTabClasses();
const tab = e.currentTarget; const tab = e.currentTarget;
this.stripTabClasses();
this.addTabClasses(tab); this.addTabClasses(tab);
this.updateUrl(tab);
} }
stripTabClasses(){ stripTabClasses(){
...@@ -67,6 +66,10 @@ class Tabs { ...@@ -67,6 +66,10 @@ class Tabs {
tab.classList.add(this.tabActiveClass); tab.classList.add(this.tabActiveClass);
document.querySelector(`#${tabId}`).classList.add(this.tabContentActiveClass); document.querySelector(`#${tabId}`).classList.add(this.tabContentActiveClass);
} }
updateUrl(tab){
window.location.hash = tab.getAttribute('href');
}
} }
export default Tabs; export default Tabs;
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