0

jquery の単一のプラグインを使用しようとしていますが、同じ機能を 2 つの異なる ID に適用したいと考えています。

どうすればこれを達成できますか。これは、次をクリックすると両方の div が自動的にスクロールする、次と前の機能の一種です。

html を見ると、同じ ID の 2 つの div があり、同じプラグインに対してその ID を呼び出す方法も ID を変更する場合、ID は一意である必要があるため、使用すべきではありません。

助けを求める

これが私が試したものです。

stepcarousel.setup({
    galleryid: 'gallerya', //id of carousel DIV
    beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
    panelclass: 'panel', //class of panel DIVs each holding content
    autostep: {enable:true, moveby:1, pause:3000},
    panelbehavior: {speed:300, wraparound:false, persist:false},
    defaultbuttons: {enable: true, moveby: 1, leftnav: ['images/left-arrow.png', 200, -30], rightnav: ['images/right-arrow.png', 10,  -30]},
    contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']
})

div id="gallerya" class="stepcarousel" style="height:731px;">
                    <div class="belt">
                        <div class="panel" style="width:252px;">
                        <ul>
                        <li class="first leaf"><a href="http://www.jobzing.com/preparation-for-an-interview/financial-analyst-interview-preparation.html" title=""> How to prepare for financial analyst interview?</a></li>
<li class="leaf"><a href="http://www.jobzing.com/preparation-for-an-interview/external-training-programs-and-salary.html" title="">Are external training programs offered by company part of salary package?</a></li>
<li class="leaf"><a href="/preparation-for-an-interview/bank.html" title="">Bank Interview Preparation</a></li>
<li class="leaf"><a href="http://www.jobzing.com/preparation-for-an-interview/prepare-for-campus-interview.html" title="">Best ways to Prepare for Campus Interview</a></li>
<li class="leaf"><a href="/preparation-for-an-interview/cognitive-abilities-tests" title="">Cognitive Abilities Test</a></li>
<li class="leaf"><a href="/preparation-for-an-interview/college.html" title="">College Interview Preparation</a></li>
<li class="leaf"><a href="http://www.jobzing.com/preparation-for-an-interview/career-goals-in-job-interview.html" title="">Discussing career goals in a job interview</a></li>
<li class="leaf"><a href="/tools/dressing-tips" title="">Dressing up for Interview</a></li>
<li class="leaf"><a href="/top-100-questions/engg" title="">Engineering Interview Questions</a></li>
<li class="leaf"><a href="http://www.jobzing.com/preparation-for-an-interview/favorite-job-destinations-in-india.html" title="">Favorite job destinations in India</a></li>
<li class="leaf"><a href="/top-100-questions/finance" title="">Finance Interview Questions</a></li>
<li class="leaf"><a href="http://www.jobzing.com/preparation-for-an-interview/group-discussion-rules-for-interview.html" title="">Group Discussion Rules for Interview updated</a></li>
<li class="leaf"><a href="http://www.jobzing.com/preparation-for-an-interview/dietician-interview-preparation.html" title="">How to Prepare for Dietician Job Interview</a></li>
<li class="leaf"><a href="http://www.jobzing.com/preparation-for-an-interview/lab-technician.html" title="">How to Prepare for Lab Technician Interview?</a></li>
<li class="leaf"><a href="http://www.jobzing.com/preparation-for-an-interview/pilot-interview-preparation.html" title="">How to Prepare for Pilot Interview</a></li>
<li class="leaf"><a href="http://www.jobzing.com/preparation-for-an-interview/accounting.html" title="">How to Prepare for an Accounting Interview</a></li>
<li class="leaf"><a href="http://www.jobzing.com/preparation-for-an-interview/insurance-agent-interview-preparation.html" title="">How to Prepare for an Insurance Agent Interview?</a></li>
<li class="leaf"><a href="http://www.jobzing.com/preparation-for-an-interview/how-to-answer-basic-interview-questions.html" title="">How to answer basic interview questions?</a></li>
                    </ul>
                        </div> 

<div id="gallerya" class="stepcarousel" style="height:160px;">
                    <div class="belt">
                        <div class="panel">
                        <ul>
                        <li>
                            <span><a href="http://www.jobzing.com/9779-project-manager.html"><b>Project Manager</u></b></a></span></span> <br />  
                            <span>A&amp;E Consulting</span><br />  
                            <span>Philippines </span>
                    </li>
                    <li>
                            <span><a href="http://www.jobzing.com/9779-project-manager.html"><b>Project Manager</u></b></a></span></span> <br />  
                            <span>A&amp;E Consulting</span><br />  
                            <span>Philippines </span>
                    </li>
                    </ul>
                        </div>  

私が作成しているページ

4

1 に答える 1

0

次のようなことを試しましたか:

、および で.setup1 回呼び出します。そして再び、、.galleryid: 'galleryA'beltclass: 'beltA'panelclass: 'panelA'galleryid: 'galleryB'beltclass: 'beltB'panelclass: 'panelB'

stepcarousel.setup({
    galleryid: 'galleryA', //id of carousel DIV
    beltclass: 'beltA', //class of inner "belt" DIV containing all the panel DIVs
    panelclass: 'panelA', //class of panel DIVs each holding content
    autostep: {enable:true, moveby:1, pause:3000},
    panelbehavior: {speed:300, wraparound:false, persist:false},
    defaultbuttons: {enable: true, moveby: 1, leftnav: ['images/left-arrow.png', 200, -30], rightnav: ['images/right-arrow.png', 10,  -30]},
    contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']
})

stepcarousel.setup({
    galleryid: 'galleryB', //id of carousel DIV
    beltclass: 'beltB', //class of inner "belt" DIV containing all the panel DIVs
    panelclass: 'panelB', //class of panel DIVs each holding content
    autostep: {enable:true, moveby:1, pause:3000},
    panelbehavior: {speed:300, wraparound:false, persist:false},
    defaultbuttons: {enable: true, moveby: 1, leftnav: ['images/left-arrow.png', 200, -30], rightnav: ['images/right-arrow.png', 10,  -30]},
    contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']
})

そして、次のような HTML:

<div id="galleryA" class="stepcarousel" style="height:731px;">
    <div class="beltA">
        <div class="panelA" style="width:252px;">
            <ul>
                <li></li>
                <li></li>
            </ul>
        </div> 
    </div>
</div>

<div id="galleryB" class="stepcarousel" style="height:160px;">
    <div class="beltB">
        <div class="panelB">
            <ul>
                <li></li>
                <li></li>
            </ul>
        </div> 
    </div>
</div>
于 2013-02-02T06:44:57.983 に答える