Folks,

I was wondering if you could tell a JavaScript kiddy like myself, who loves 
to cut snipits of code and reuse them if there is a practical way to use 
common javacript to enhance out tiddlywikis.

An example may be here https://www.w3schools.com/w3css/w3css_tabulators.asp

I know this could be achived in other ways however such examples exist out 
in the world and they can help develop solutions quickly.

In the example below I am using a w3.css stylesheet.

Where some html and css call for a little javascript

<div id="London" class="city">
  <h2>London</h2>
  <p>London is the capital of England.</p>
</div>

 <div id="Paris" class="city" style="display:none">
  <h2>Paris</h2>
  <p>Paris is the capital of France.</p> 
</div>

<div id="Tokyo" class="city" style="display:none">
   <h2>Tokyo</h2>
  <p>Tokyo is the capital of Japan.</p>
</div>



<div class="w3-bar w3-black">
  <button class="w3-bar-item w3-button" onclick="openCity('London')">London
</button>
  <button class="w3-bar-item w3-button" onclick="openCity('Paris')">Paris
</button>
  <button class="w3-bar-item w3-button" onclick="openCity('Tokyo')">Tokyo
</button>
 </div>


and 

function openCity(cityName) {
    var i;
    var x = document.getElementsByClassName("city");
    for (i = 0; i < x.length; i++) {
        x[i].style.display = "none"; 
    }
    document.getElementById(cityName).style.display = "block"; 
}

Clearly this is quite simple javascript involving defining a single 
function.

Is there a way to get this function added to the wiki so that the HTML/CSS 
solution works?.

Thanks in advance
Tony

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/8e038951-2cd6-47c5-971c-244a7778e100%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to