2016-09-30 57 views
0

我希望有人能幫助我。基本上,我正在使用Jquery Step,「Vertical Steps Example」on http://www.jquery-steps.com/Examplesjquery步驟 - 如何複製下一個和上一個按鈕?例如在頂部和底部使用

我想重複'next'和'previous'按鈕,以便坐在內容區域的頂部和底部,因爲我有很多每一步中的文字和圖像。

有人可以幫助如何複製這些按鈕?我使用的示例代碼如下:

<script> 
      $(function() 
      { 
       $("#wizard").steps({ 
        headerTag: "h2", 
        bodyTag: "section", 
        transitionEffect: "slideLeft", 
        stepsOrientation: "vertical" 
       }); 
      }); 
    </script> 

    <div id="wizard"> 
     <h2>Title One</h2> 
     <section> 
      <p>Content for Title One</p> 
     </section> 

     <h2>Title Two</h2> 
     <section> 
      <p>Content for Title Two</p> 
     </section> 

    </div> 

回答

0

試試這個:

$('#wizard').prepend($('#wizard .actions').clone().addClass("top-actions")); 

//then add event 


$('#wizard .top-actions').on("click", ".btn", function (e) { 

    var $element = $(this); 

    //console.log($element); 

    if ($element.hasClass("prev") == true) { 
     $('#wizard .actions:not(.top-actions) a[href="#previous"]').click(); 
    } 

    if ($element.hasClass("next") == true) { 
     $('#wizard .actions:not(.top-actions) a[href="#next"]').click(); 
    } 

}); 
+0

感謝您的幫助,但遺憾的是,似乎沒有工作 – DHJ

+0

我不;噸注意到您在使用ID: –

+0

沒有確定這是否可行: $('#wizard')。prepend($('#wizard .actions')。clone()。addClass(「top-actions」)) –

相關問題