2011-11-22 171 views
0

我想在LightBoxes上顯示HTML表單。每個燈箱都會有一個按鈕。 onClick按鈕,一個新的LightBox應該打開一個新的HTML表單。我如何做這樣的導航。我發現圖像之間的導航,但不是HTML表單。鏈接LightBox中的LightBox

回答

3

您不需要打開新的燈箱,而是將新窗體的內容加載到當前窗體中。另外,不要從按鈕中捕獲點擊事件,因爲如果用戶嘗試按鍵盤上的輸入提交表單,它就不會起作用。你可以做這樣的事情:

$('#lightbox form').submit(function(){ 

    // some validation logic can be here 

    // load the form from another file 
    $('#lightbox').load('step-two-form.html'); 

    // OR insert it from the same document 
    $('#lightbox').html($('#step-two-form')); 

    // and return false for avoid reload the page 
    return false; 
}); 
0

可以讓兩個獨立的div在同一收藏夾內容

<div class="lightbox"> 
    <div id="firstdiv">CONTENT 1 that contains a button to show #seconddiv and hide #firstdiv</div> 
    <div id="seconddiv" class="hidden">CONTENT 2</div> 
</div> 

我已經在這裏類似
http://www.klein-associes.com/grand_public/#
點擊「ACCES法新社/ DISTRIBUTEUR」的東西然後「s'inscrire」進行演示

$('#firstdiv #button1').click(function(){ 
     $('#firstdiv').fadeOut('fast',function(){ 
      $('#seconddiv').fadeIn('fast'); 
     }); 
});