jquery步骤 - 如何复制下一个和上一个按钮?例如在顶部和底部使用

问题描述:

我希望有人能帮助我。基本上,我正在使用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> 

试试这个:

$('#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”)) –