Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. if (document.getElementById("tab1")) {
  2. document.getElementById("tab1").style.display = "flex";
  3. document.getElementsByClassName("tablinks")[0].className += " active";
  4. }
  5. var durl = String(document.URL);
  6.  
  7. if (durl.indexOf("#") != -1) {
  8. durl = durl.substring(durl.indexOf("#") + 1,durl.length);
  9. openTab(event, durl);
  10. }
  11.  
  12. function openTab(evt, name) {
  13. var i, tabcontent, tablinks;
  14. tabcontent = document.getElementsByClassName("tabcontent");
  15. for (i = 0; i < tabcontent.length; i++) {
  16. tabcontent[i].style.display = "none";
  17. }
  18. tablinks = document.getElementsByClassName("tablinks");
  19. for (i = 0; i < tablinks.length; i++) {
  20. tablinks[i].className = tablinks[i].className.replace(" active", "");
  21. }
  22. document.getElementById(name).style.display = "flex";
  23. if (evt == undefined) {
  24. document.getElementsByClassName(durl)[0].className += " active";
  25. setTimeout(function() {
  26. window.scroll(0, document.getElementsByClassName("tab")[0].offsetTop)
  27. }, 1000);
  28. } else {
  29. evt.currentTarget.className += " active";
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement