Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

help with javascript to css to twine

$
0
0
StoryInit passage
<<set $myFont=["20px", "40px", "60px", "80px"]>>
<style>

  <button class="content">Fight</button>
  <button class="content">Bag</button>
  <button class="content">Pokemon</button>
  <button class="content">Run</button>

</style>

<<set $elements = document.getElementsByClassName("content")>>
<<for _x = 0; _x < $elements.length; _x++>>

<<set $elements[_x].style.fontSize=$myFont[_x]>>


<</for>>
Removing the style shows the buttons all the same size, while adding it gives an "undefined function" error.

How do I get this array to loop through the Class CSS and change each ones font size accordingly? Put it in the passageheader or before the passage loads its DOMS? or whatevers?

Viewing all articles
Browse latest Browse all 1844

Trending Articles