Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function openProperty(evt, property) {
- var i, tabcontent, tablinks;
- tabcontent = document.getElementsByClassName("tabcontent");
- for (i = 0; i < tabcontent.length; i++) {
- tabcontent[i].style.display = "none";
- }
- tablinks = document.getElementsByClassName("tablinks");
- for (i = 0; i < tablinks.length; i++) {
- tablinks[i].className = tablinks[i].className.replace(" active", "");
- }
- document.getElementById(property).style.display = "block";
- evt.currentTarget.className += " active";
- };
- <div class="oil-prop">
- <div class="tab">
- <button class="tablinks" onclick="openProperty(event, 'aroma')"><i class="icon-olive" aria-hidden="true"></i><br><span class="text-btn">aroma</span></button>
- <button class="tablinks" onclick="openProperty(event, 'flavour')"><i class="icon-drop" aria-hidden="true"></i><br><span class="text-btn">flavour</span></button>
- <button class="tablinks" onclick="openProperty(event, 'pairings')"><i class="icon-pairings" aria-hidden="true"></i><br><span class="text-btn">pairings</span></button>
- <button class="tablinks" onclick="openProperty(event, 'variety')"><i class="icon-leaf" aria-hidden="true"></i><br><span class="text-btn">variety</span></button>
- </div>
- <div id="aroma" class="tabcontent">
- <h3>Aroma</h3>
- <p>Medium-fruity with notes of <b>artichoke</b> and <b>green apple</b>.</p>
- </div>
- <div id="flavour" class="tabcontent">
- <h3>Flavour</h3>
- <p><b>Fresh fruity</b> taste with a mild <b>peppery</b> finish.</p>
- </div>
- <div id="pairings" class="tabcontent">
- <h3>Pairings</h3>
- <p>Ideal with meat and fish. Goes well with vegetables, especially sweeter-tasting ones.</p>
- </div>
- <div id="variety" class="tabcontent">
- <h3>Olive Varieties</h3>
- <p><b>Leccino, Pendolino and Leccio del Corno</b></p>
- </div>
- <div class="divider-prop">
- </div>
- <div id="tab-bg-div"></div>
- <div class="border-prop"></div>
- </div>
Add Comment
Please, Sign In to add comment