Jump to content

ForM4iN

Members
  • Posts

    16
  • Joined

  • Last visited

Posts posted by ForM4iN

  1. Of course you will need to include bootstrap and w3css together, since the latest link you provided is a Bootstrap example, the code I provided is for w3css, which may course a bit of conflict.

     

     

    Yes! It should as long as the links have the required class name, and onclick event to call required function.

     

    The Problem was, that your code is focused on tabs, isnt it? Because when i clicked that link i couldnt scroll anymore and could only see the content of the linked id.

  2. Not that we talk different things:

     

    If i have this navbar:

     

    <ul class="w3-navbar w3-dark-grey w3-xlarge">
    <li><a class="w3-hover-black" href="#0">Home</a></li>
    <li><a class="w3-hover-blue" href="#1">Link 1</a></li>
    <li><a class="w3-hover-red" href="#2">Link 2</a></li>
    <li><a class="w3-hover-yellow" href="#3">Link 3</a></li>
    </ul>
    and these ids:
    <div id="0" class="w3-black">
    0
    </div>
    <div id="1" class="w3-blue">
    1
    </div>
    <div id="2" class="w3-red">
    2
    </div>
    <div id="3" class="w3-yellow">
    3
    </div>
    i want, that when i am in id 1that the link text color which was white before to be blue!
    and when i am in id 2 i want id 1 to be white again and id2 to be red.
    what do i have to do?
  3. Not in present state but with

    function openCity(evt, cityName) {
    
    var Tabcolor=['red','blue','green'];// set colours for tabs same sequence order the tabs are in
    
      var i, x, tablinks;
      x = document.getElementsByClassName("city");
      for (i = 0; i < x.length; i++) {
          x[i].style.display = "none";
          
      }
      tablinks = document.getElementsByClassName("tablink");
      for (i = 0; i < x.length; i++) {
      tablinks[i].dataset.indexRef=i;
      var tabColorRef=Tabcolor[tablinks[i].getAttribute("data-index-ref")];
      tablinks[i].className = tablinks[i].className.replace(" w3-"+tabColorRef, "");
      }
      document.getElementById(cityName).style.display = "block";
      evt.currentTarget.className += " w3-"+Tabcolor[evt.currentTarget.getAttribute("data-index-ref")];
    }
    

    Yes!

     

    Thank you so much!!

×
×
  • Create New...