Guest User

Untitled

a guest
Nov 21st, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. function openProperty(evt, property) {
  2. var i, tabcontent, tablinks;
  3. tabcontent = document.getElementsByClassName("tabcontent");
  4. for (i = 0; i < tabcontent.length; i++) {
  5. tabcontent[i].style.display = "none";
  6. }
  7. tablinks = document.getElementsByClassName("tablinks");
  8. for (i = 0; i < tablinks.length; i++) {
  9. tablinks[i].className = tablinks[i].className.replace(" active", "");
  10. }
  11. document.getElementById(property).style.display = "block";
  12. evt.currentTarget.className += " active";
  13. };
  14.  
  15. <div class="oil-prop">
  16. <div class="tab">
  17.  
  18. <button class="tablinks" onclick="openProperty(event, 'aroma')"><i class="icon-olive" aria-hidden="true"></i><br><span class="text-btn">aroma</span></button>
  19. <button class="tablinks" onclick="openProperty(event, 'flavour')"><i class="icon-drop" aria-hidden="true"></i><br><span class="text-btn">flavour</span></button>
  20. <button class="tablinks" onclick="openProperty(event, 'pairings')"><i class="icon-pairings" aria-hidden="true"></i><br><span class="text-btn">pairings</span></button>
  21. <button class="tablinks" onclick="openProperty(event, 'variety')"><i class="icon-leaf" aria-hidden="true"></i><br><span class="text-btn">variety</span></button>
  22. </div>
  23.  
  24. <div id="aroma" class="tabcontent">
  25.  
  26. <h3>Aroma</h3>
  27. <p>Medium-fruity with notes of <b>artichoke</b> and <b>green apple</b>.</p>
  28. </div>
  29.  
  30. <div id="flavour" class="tabcontent">
  31. <h3>Flavour</h3>
  32. <p><b>Fresh fruity</b> taste with a mild <b>peppery</b> finish.</p>
  33. </div>
  34. <div id="pairings" class="tabcontent">
  35. <h3>Pairings</h3>
  36. <p>Ideal with meat and fish. Goes well with vegetables, especially sweeter-tasting ones.</p>
  37. </div>
  38.  
  39. <div id="variety" class="tabcontent">
  40. <h3>Olive Varieties</h3>
  41. <p><b>Leccino, Pendolino and Leccio del Corno</b></p>
  42. </div>
  43. <div class="divider-prop">
  44. </div>
  45. <div id="tab-bg-div"></div>
  46. <div class="border-prop"></div>
  47. </div>
Add Comment
Please, Sign In to add comment