1

結果が国名でグループ化されているコールドフュージョン クエリを取得しました。これをクリックして、国の下のリストを開いたり閉じたりしようとします。しかし、私はこの兄弟とこの両親と正しく働くことができません。その結果、国名をクリックすると、たとえば 4 番目の国名をクリックすると、すべての子が閉じられ、前の 3 つの国名も閉じられます。誰かが正しいセレクターを選択するのを手伝ってくれますか? 前もってありがとう、ミシェル

コード:

<script type="text/javascript" language="javascript">  
    $(document).ready(function(){
        var toggleMinus = '<cfoutput>#variables.strWebAddress#</cfoutput>/images/bullet_toggle_minus.png';
        var togglePlus = '<cfoutput>#variables.strWebAddress#</cfoutput>/images/bullet_toggle_plus.png';
        var $subHead = $('table#categorylist tbody th:first-child');
        $subHead.prepend('<img src="' +toggleMinus+ '" alt="collapse this section" />&nbsp;');
        $('img', $subHead).addClass('clickable').click(function(){
            var toggleSrc = $(this).attr('src');
            if(toggleSrc == toggleMinus){
               $(this).attr('src',togglePlus).parents('.country').siblings().fadeOut('fast');
            }else{
              $(this).attr('src',toggleMinus).parents('.country').siblings().fadeIn('fast');
            }
        });
     }); 
</script>

<table width="95%" border="0" cellspacing="2" cellpadding="2" align="center id="categorylist"> 
<thead>
    <tr>
        <th class="text3" width="15%">
            <cfmodule template="../custom_tags/get_message.cfm" keyName="L_ACTOR_CODENUMBER">
        </th>
        <th class="text3" width="15%">
            <cfmodule template="../custom_tags/get_message.cfm" keyName="L_ACTOR_CODE">
        </th>
        <th class="text3" width="55%">
            <cfmodule template="../custom_tags/get_message.cfm" keyName="L_ACTOR_NAME">
        </th>
        <th class="text3" width="15%">
            <cfmodule template="../custom_tags/get_message.cfm" keyName="L_ACTIVE">
        </th>
    </tr>
</thead>
<tbody id="content">
<cfoutput query="qryCategoryUrl" group="country_name" groupcasesensitive="false">
    <tr class="country">
        <th style="font-weight:bold; text-align:left;" colspan="4">#country_name#</th>
    </tr>
<cfoutput>
    <tr>
        <td valign="top" class="text3">#Replace(ACTOR_CODENUMBER, Chr(13) & Chr(10), "<br>", "ALL")#&nbsp;</td>
        <td valign="top" class="text3">#Replace(ACTOR_CODE, Chr(13) & Chr(10), "<br>", "ALL")#&nbsp;</td>
        <td valign="top" class="text3">#Replace(ACTOR_NAME, Chr(13) & Chr(10), "<br>", "ALL")#&nbsp;</td>
        <td valign="top" class="text3"><cfmodule template="../custom_tags//get_message.cfm" keyName="#ACTIVE_display(qryCategoryUrl.ACTIVE)#"></td>
    </tr>
</cfoutput>
</cfoutput>
</tbody>
</table>
4

2 に答える 2

1

それ以外の:

.parents('.country').siblings().fadeOut('fast');

これを試して:

.closest('.country').nextUntil('.country').fadeOut('fast');

そしてもちろん、同じ変更を に適用します.fadeIn().fadeToggle()docsを調べることもできます。

以下は (縮小された) 例です: http://jsfiddle.net/redler/5sqJz/。この例には影響しませんが、おそらくこれらの詳細行の初期状態を非表示に設定することになるでしょう。

于 2011-01-24T15:06:10.453 に答える
0

すごい cfmodule の使用法、cfmodule はメモリを大量に消費する可能性があります。

私がいつもお勧めしているのは、どのブラウザーでも自分のページを試して、http://www.selectorgadget.com/の SelectorGadget ブックマークレットを使用することです。

これにより、アプリのニーズに合わせて、正しいセレクターを簡単にテストおよび確認できます。

于 2011-01-25T14:58:01.663 に答える