mirror of
https://github.com/google/material-design-lite.git
synced 2024-08-16 15:50:34 +03:00
Merge pull request #4860 from MitchLillie/fix/allow-hrefs-in-tabs
fix(tabs): Allow tab hrefs to point anywhere
This commit is contained in:
commit
40290b399a
@ -140,13 +140,15 @@
|
||||
}
|
||||
|
||||
tab.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
var href = tab.href.split('#')[1];
|
||||
var panel = ctx.element_.querySelector('#' + href);
|
||||
ctx.resetTabState_();
|
||||
ctx.resetPanelState_();
|
||||
tab.classList.add(ctx.CssClasses_.ACTIVE_CLASS);
|
||||
panel.classList.add(ctx.CssClasses_.ACTIVE_CLASS);
|
||||
if (tab.getAttribute('href').charAt(0) === '#') {
|
||||
e.preventDefault();
|
||||
var href = tab.href.split('#')[1];
|
||||
var panel = ctx.element_.querySelector('#' + href);
|
||||
ctx.resetTabState_();
|
||||
ctx.resetPanelState_();
|
||||
tab.classList.add(ctx.CssClasses_.ACTIVE_CLASS);
|
||||
panel.classList.add(ctx.CssClasses_.ACTIVE_CLASS);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user