Can't switch tab with materialtabs

Get help with using Metro 4 components
Post Reply
robertledoux
Posts: 1
Joined: Sat Aug 31, 2019 2:03 pm
Status: Offline

Can't switch tab with materialtabs

Post by robertledoux » Sat Aug 31, 2019 2:05 pm

Hello,

I'm looking for manual tab switching via JavaScript or via the browser URL (like : http://localhost/index#tab-01). But nothing work. With standard tabs, JS work, but with MaterialTabs nothing.

Code: Select all

<ul class="app-bar-present pos-relative" data-role="materialtabs" id="event-submenu">
    <li class="active"><a href="#introduction">Présentation</a></li>
    <li><a href="#rpg">Jeux de Rôle</a></li>
    <li><a href="#boardgame">Jeux de Plateau</a></li>
    <li><a href="#faq">FAQ</a></li>
</ul>

Code: Select all

function openTab(num){
    var tabs = $("#event-submenu").data("materialtabs");
    tabs.open(num);
}
Uncaught TypeError: tabs.open is not a function
at openTab (site.js?v=jAFfeTUtFY…BrmUNISpS6oy04OHA:7)
at <anonymous>:1:1
openTab @ site.js?v=jAFfeTUtFY…BrmUNISpS6oy04OHA:7
(anonymous) @ VM5632:1

Post Reply