I am converting our webpage's older jQuery based DOM manipulations to vanilla javascript, Most has gone surprisingly easy, but have hit a wall with the flyout menus.
We use a simple format of tabs and hidden menu divs:
<div class="tab">tab 1</div>
<div class="tab">tab 2</div>
<div class="tab">tab 3</div>
<div class="tab">tab 4</div>
<div class="menu">menu 1</div>
<div class="menu">menu 2</div>
<div class="menu">menu 3</div>
<div class="menu">menu 4</div>
The former jQuery based system used .index() to determine which tab was clicked and then the .eq() to control which hidden menu was revealed.
I am now wondering how I might go about doing the same with vanilla javascript.
In worse case scenario I could rename the classes as tab1, tab2, menu1, menu2 and write individual scripts for each, but I liked the flexibility the index/eq system provided for adding or removing menu panels.
Thanks