Как читать разный контент в нескольких модальных окнах с другой страницы - PullRequest
0 голосов
/ 19 июня 2020

У меня есть две страницы - для текущей страницы объяснения A и B:

  • страница A имеет содержимое с href, которое ссылается на другое содержимое в modal на странице B
  • страница B имеет несколько modal с разными id

Как я могу открыть правую modal, так как у меня несколько modal с разными id. Каждое модальное окно содержит контент с id. Чтобы указать на правильный контент на странице B, у меня нет текста в <a href="" id=""> - эти a скорее являются якорями.

xsl кодовая страница A:

<xsl:for-each select="$referenced-re//span[@type='interp']/ref">
     <xsl:variable name="href3" select="@target"/>
     <a href="{$href3}" name="{@xml:id}"><xsl:value-of select="text()"/></a><!-- points to the anchor in page B -->
</xsl:for-each>

xsl кодовая страница B:

<!-- a modal amongst other modal in the same page B | each modal has several ID -->
<h5 style="font-weight: 500">Further details on “What Result”
            <div id="details-results"> </div>

        <xsl:element name="A">
            <xsl:attribute name="href">
                <xsl:text>#modal-container-result-</xsl:text> <!-- different for each modal -->
                <xsl:value-of select="$currentEntity"/>
            </xsl:attribute>
            <xsl:attribute name="aria-label">
                <xsl:text>Open Navigation</xsl:text>
            </xsl:attribute>
            <button class="button-result" >
                <span>View</span>
            </button>
        </xsl:element>
  </h5>

 <xsl:element name="div">
            <xsl:attribute name="ID">
                <xsl:text>modal-container-result-</xsl:text><!-- each modal has a different ID -->
                <xsl:value-of select="$currentEntity"/>
            </xsl:attribute>
            <xsl:attribute name="class">
                <xsl:text>modal-container</xsl:text>
            </xsl:attribute>
            <div class="modal" id="query">
                <div class="box">
                    <div class="sticky">
                        <a href="#details-results" aria-label="Close Modal">
                            <button class="btn">
                                <i class="fa fa-close"/>
                            </button>
                        </a>
                    </div>
                </div>


                <script src="https://www.kryogenix.org/code/browser/sorttable/sorttable.js"/>
                <table class="sortable table-5" id="result">


                 <tr style="background-color: #C8FE2E; font-style: italic">
                  <td>
                   <a href="#{.//ancestor-or-self::interp/@xml:id}" id="{.//ancestor-or-self::interp/@xml:id}" data-target="#query" data-toggle="modal" /><!-- anchor -->
                  <a href="../corpus_ilimilku.html#{.//ancestor-or-self::interp//ref[@n='1']/tokenize(@target)!substring-after(., '#')}" id="{@xml:id}"
                            onclick="window.open(this.href, 'mywin',
                            'left=20,top=20,width=1200,height=250,toolbar=0,resizable=0'); return false;" >
                   <xsl:value-of select=".//ancestor-or-self::interp//key('verb-emph', tokenize(@target)!substring-after(., '#'))[@type='emphasis']/replace(replace(replace(replace(tokenize(@xml:id), '_', ':'), 'l', ''), 'ktu', 'KTU '), '\w+:*$', ' ')"/>
                 </a>
                 <span style="font-weight: 700"><xsl:text>→ </xsl:text></span>
                 <a href="../verb.html{.//ancestor-or-self::interp//oRef/@target}"><xsl:value-of select=".//ancestor-or-self::interp//oRef/replace(tokenize(@target!substring-after(., '#')), '\d+$', '')"/></a>
          </td>
         </tr>
         <!-- other row and columns -->
       </table>

Как есть, когда я нажимаю ссылку в html страница A, он переходит к html странице B. Здесь два экрана печати страницы B: (1) список кнопок «просмотр» , который указывает на modal, (2) один из modal.

html из раздела a на странице B

<td>
     <a href="#ktu1-3_ii_l18_int" id="ktu1-3_ii_l18_int" data-target="#query" data-toggle="modal"></a><!-- anchor -->
     <a href="../corpus_ilimilku.html#ktu1-3_ii_l18_t%C5%A1tql" id="" onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=1200,height=250,toolbar=0,resizable=0'); return false;">KTU 1-3:ii:18: </a><span style="font-weight: 700">→ </span><a href="../verb.html../../verb.html#ql">ql</a>
</td>

Заранее благодарим за добрый совет.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...