2017-12-21 7 views
0

Ich möchte das DOM bei Klick ändern. Hier ist meine Flüssigkeit (google.md):Ändern der Flüssigkeit Variable bei Klick

--- 
layout: pastTournaments 
title: Google Tournament 
permalink: /tournaments/google/ 
--- 

<h5 class="column-wrapper centered">These are the rankings for the Google Qualifying tournament, which was hosted on December 2, 2017.</h5> 
<br> 
<div class="column-wrapper"> 
    <div class="grid-x"> 
     <div class="large-6 shrink cell"> 
      <table> 
       <thead> 
        <tr> 
        <th width="20" class="centered">Rank</th> 
        <th width="150" class="centered">Team Number</th> 
        <th width="150" class="centered">Team</th> 
        <th width="50" class="centered">QP</th> 
        <th width="50" class="centered">RP</th> 
        <th width="50" class="centered">Plays</th> 
        </tr> 
       </thead> 
       <tbody> 
        {% assign sorted = site.data.google.teams | sort:"rank" %} 
        {% for team in sorted %} 
         <tr class="table" onclick="ranks()"> 
          <td class="centered">{{ team.rank }}</td> 
          <td class="centered">{{ team.number }}</td> 
          <td class="centered">{{ team.name }}</td> 
          <td class="centered">{{ team.qp }}</td> 
          <td class="centered">{{ team.rp }}</td> 
          <td class="centered">{{ team.plays }}</td> 
         </tr> 
        {% endfor%} 
       </tbody> 
      </table> 
     </div> 
     {% for team in site.data.google.teams %} 
     <!--I want to remove this if tag because it is specific to one team--> 
      {% if team.name == 'Q' %} 
       <!--I want to move this line --> 
       <div class="large-6 shrink cell"> 
        <h2 class="centered"><strong>{{ team.number }} {{ team.name }}</strong></h2> 
        <h4 class="centered"><strong>Rank: </strong>#{{ team.rank }}</h4> 
        <p class="centered"><strong>QP: </strong>{{ team.qp }}</p> 
        <p class="centered"><strong>RP: </strong>{{ team.rp }}</p> 
        <p class="centered"><strong>Plays: </strong>{{ team.plays }}</p> 
        <div id="ranks-right"></div> 
       <!--To this line --> 
       </div> 
      {% endif %} 
     {% endfor %} 

    </div> 
</div> 

Ich brauche es so, dass der {{team.name}} wird für das Team gesetzt werden, der angeklickt wird.

+0

Ich verstehe nicht, warum Sie die gleichen Daten zweimal drucken möchten. –

+0

ich dont, ich möchte es verschieben –

Antwort

0

Sie möchten auf einen Klick eine Jekyll-Variable setzen. Das ist nicht möglich. Du verstehst nicht ganz, wie Jekyll funktioniert. Sie sind fast da ... aber die Sache, die Sie verpassen, ist, dass Variablen nur während des Builds gesetzt werden. Wenn Sie möchten, dass sich etwas im DOM mit einem Klick ändert, müssen Sie Javascript verwenden. Liquid kann Ihnen damit nicht helfen. Es tut uns leid.

+0

Ok, aber wissen Sie, wie das geht? –

+1

Ich bin bereit, Ihnen dabei zu helfen. Aber bitte versuchen Sie es zuerst selbst und stellen Sie eine neue Frage, um die Probleme zu beschreiben, denen Sie begegnen. – JoostS