Jump to content

dsonesuk

Members
  • Posts

    11,220
  • Joined

  • Last visited

  • Days Won

    117

Posts posted by dsonesuk

  1. You just need to use 'this' which is the element that the onclick event occurred  as in changeImage(this, 'bannerImage_left');

    then within function function changeImage(elem, bannerId)

    get the src: from 1st parameter elem

    elem.src and remove '_thumb' with elem.src.replace('_thumb','');

    then add converted src to 2nd parameter bannerid ref src using document.getElementById(bannerId).src

  2. If you are going to table layout which i don't recommend, I suggest you use more columns as most grid based framework use 10 to 12 grid system, with the 12 given you possibility of 1/4s 1/3s  etc and few more division than the 10 grid system.

  3. On 2/12/2024 at 4:55 AM, DavidHenson said:

    Thanks, but I don't know what those things are, I wouldn't know where to put them or how to use them. I've decided just to move on. The accordion is fine the way it is.  

    Yea, I know what you mean. If only there was a website of some kind that would explain what these things are and how to implement them....👀🤦

  4. Right click the text "freight home" and select 'inspect' the text should be highlighted and web developers tools panel should appear showing the HTML element to left and CSS rules applied to that element to the right! It also shows the css filename and line of the affecting rule position. That selector with color: property is what controls the text color(It always shows the selector with highest precedence at the top, as if you scroll down you will see multiple anchor selectors with color: properties. )

    .navbar-inverse .navbar-nav > li > a {
      color: #9d9d9d;
    }

    This is the css to change from #9d9d9d; to #ffffff; HEX (white); Although I would create a custom.css file and put this change in that! then make sure the link to the custom.css file is below the link to bootstrap.css so it becomes a higher precedence over same bootstrap rules you are changing.

  5. You have to restrict it to those in tab grouping by placing a container around the grouping and making the function work to that grouping where click event happened.

     

    <!DOCTYPE html>
    <html>
    <title>W3.CSS</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
    <body>
    
    <div class="w3-container">
      <h2>Tabs</h2>
      <p>Tabs are perfect for single page web applications, or for web pages capable of displaying different subjects. Click on the links below.</p>
    </div>
    <div class="parent_target">
    <div class="w3-bar w3-black">
      <button class="w3-bar-item w3-button" onclick="openCity(this,'London1')">London1</button>
      <button class="w3-bar-item w3-button" onclick="openCity(this,'Paris1')">Paris1</button>
      <button class="w3-bar-item w3-button" onclick="openCity(this,'Tokyo1')">Tokyo1</button>
    </div>
    
    <div id="London1" class="w3-container city">
      <h2>London1</h2>
      <p>London is the capital city of England.</p>
    </div>
    
    <div id="Paris1" class="w3-container city" style="display:none">
      <h2>Paris1</h2>
      <p>Paris is the capital of France.</p> 
    </div>
    
    <div id="Tokyo1" class="w3-container city" style="display:none">
      <h2>Tokyo1</h2>
      <p>Tokyo is the capital of Japan.</p>
    </div>
    </div>
    <div class="parent_target">
    <div class="w3-bar w3-blue">
      <button class="w3-bar-item w3-button" onclick="openCity(this,'London2')">London2</button>
      <button class="w3-bar-item w3-button" onclick="openCity(this,'Paris2')">Paris2</button>
      <button class="w3-bar-item w3-button" onclick="openCity(this,'Tokyo2')">Tokyo2</button>
    </div>
    
    <div id="London2" class="w3-container city">
      <h2>London2</h2>
      <p>London is the capital city of England.</p>
    </div>
    
    <div id="Paris2" class="w3-container city" style="display:none">
      <h2>Paris2</h2>
      <p>Paris is the capital of France.</p> 
    </div>
    
    <div id="Tokyo2" class="w3-container city" style="display:none">
      <h2>Tokyo2</h2>
      <p>Tokyo is the capital of Japan.</p>
    </div>
    </div>
    <div class="w3-container w3-red">
      <h2>The Issue</h2>
      <p>I want the two tab sections to work indvidually of each other. I want to be able to click London 1 and it not close anything in tab bar 2 and vice versa.</p>
    </div>
    
    <script>
    function openCity(elem, cityName) {
    
      var i;
      var x = elem.parentNode.parentNode.getElementsByClassName("city");
      for (i = 0; i < x.length; i++) {
      
        x[i].style.display = "none"; 
    
      }
      document.getElementById(cityName).style.display = "block";  
    }
    </script>
    
    </body>
    </html>

     

  6. If you want to use inline CSS you MUST use STYLE to do so.

     

    
              
    			function hideQuote0()
    			{
    				document.getElementById("span0").style.color = "rgb(255,0,0)"; 
    				setTimeout(hideQuote1, 3000); 	
    			}
    			function hideQuote1()
    			{
    				document.getElementById("span0").style.color = "rgb(0,255,0)"; 
    				setTimeout(hideQuote2, 3000); 	
    			}
    			function hideQuote2()
    			{
    				 document.getElementById("span0").style.color = "rgb(0,0,0)"; 
    			}
    
    
    <div id="div0" style.display = "block";> 
    			<span id="span0" style="font-weight: 900; color: rgb(0,0,0);"> QUOTE GOES HERE </span><br><br> 
    		</div> 	

     

×
×
  • Create New...