2012-03-23 31 views
1

我使用IE 8和jQuery智能嚮導版本3.2.0。我注意到,將智能嚮導附加到額外的<div>標記中(意圖在jQuery對話框彈出窗口中顯示嚮導),當爲onLeaveStep事件指定函數時,嚮導不會前進步驟。jquery智能嚮導凍結

現在的代碼:

的JavaScript設置嚮導:

// wizard functions 
function leaveAStepCallback(obj) { 
    // Get current step 
    var step_num = obj.attr('rel'); // get the current step number 
} 
function onFinishCallback() { 
    alert('Finish Called'); 
} 
function showStep(obj) { 
    // Get current step 
    var step_num = obj.attr('rel'); // get the current step number 
} 

和HTML標記(:與精靈的事件相關聯的

$('#wizard').smartWizard({ transitionEffect: 'slideleft', onLeaveStep: leaveAStepCallback, onFinish: onFinishCallback}); 

簡單的功能爲了簡潔起見,我刪除了<p>標籤中的步驟內容 - 這導致其功能與缺少內容一樣缺乏功能,因此可以排除)

<div id="wizDialog"> 

<div id="wizard" class="swMain"> 
     <ul> 
      <li><a href="#step-1"> 
      <label class="stepNumber">1</label> 
      <span class="stepDesc"> 
       Step 1<br /> 
       <small>Step 1 - </small> 
      </span> 
      </a></li> 
      <li><a href="#step-2"> 
      <label class="stepNumber">2</label> 
      <span class="stepDesc"> 
       Step 2<br /> 
       <small>Step 2 - </small> 
      </span> 
      </a></li> 
      <li><a href="#step-3"> 
      <label class="stepNumber">3</label> 
      <span class="stepDesc"> 
       Step 3<br /> 
       <small>Step 3 - </small> 
      </span>     
      </a></li> 
      <li><a href="#step-4"> 
      <label class="stepNumber">4</label> 
      <span class="stepDesc"> 
       Step 4<br /> 
       <small>Step 4 - </small> 
      </span>     
      </a></li> 

      <li><a href="#step-5"> 
      <label class="stepNumber">5</label> 
      <span class="stepDesc"> 
       Step 5<br /> 
       <small>Step 5 - </small> 
      </span>     
      </a></li>  
      <li><a href="#step-6"> 
      <label class="stepNumber">6</label> 
      <span class="stepDesc"> 
       Step 6<br /> 
       <small>Step 6 - </small> 
      </span>     
      </a></li> 
      <li><a href="#step-7"> 
      <label class="stepNumber">7</label> 
      <span class="stepDesc"> 
       Step 7<br /> 
       <small>Step 7 - </small> 
      </span>     
      </a></li> 
      <li><a href="#step-8"> 
      <label class="stepNumber">8</label> 
      <span class="stepDesc"> 
       Step 8<br /> 
       <small>Step 8 - </small> 
      </span>     
      </a></li>      
     </ul> 
     <div id="step-1"> 
     <h2 class="StepTitle">Step 1 Content</h2> 
      <p> 
      </p>         
     </div> 
     <div id="step-2"> 
     <h2 class="StepTitle">Step 2 Content</h2> 
      <p> 
      </p>   
     </div>      
     <div id="step-3"> 
     <h2 class="StepTitle">Step 3 Content</h2> 
      <p> 
      </p> 
     </div> 
     <div id="step-4"> 
     <h2 class="StepTitle">Step 4 Content</h2> 
      <p> 
       </p> 

     </div> 
     <div id="step-5"> 
     <h2 class="StepTitle">Step 5 Content</h2> 
      <p> 
      </p> 

     </div> 
     <div id="step-6"> 
     <h2 class="StepTitle">Step 6 Content</h2> 
      <p> 
       </p> 

     </div> 
     <div id="step-7"> 
     <h2 class="StepTitle">Step 7 Content</h2> 
      <p> 

      </p> 

     </div> 
     <div id="step-8"> 
     <h2 class="StepTitle">Step 8 Content</h2> 
      <p> 
      </p> 

     </div>  

</div> 
</div> 

有沒有人有類似的結果呢?或者有解釋爲什麼當嵌套在額外的<div>標籤中時嚮導不能工作?

回答

1

onLeaveStep要求您返回一個布爾值。返回true,你將能夠通過嚮導來推進。

+0

謝謝,這似乎工作,但步驟中的元素似乎不可用(文本框,單選按鈕)。我可以將注意力放在元素上,但它不會接受來自鍵盤的任何輸入。 – Andrew 2012-05-03 16:35:37