2011-06-03 103 views
0

我使用fancybox的ajax方法打開本身包含一個鏈接的內容,該鏈接在其位置打開另一個模式。這一切工作正常。 我的問題是,如何添加「返回」功能,以便在當前打開的模式中單擊「返回」鏈接時,它會打開以前打開的模式。在這種情況下,第一個模式打開?fancybox - 向後和向前導航

到目前爲止的代碼:

$("a.trans").fancybox({ 
    ajax : { 
     type   : "POST", 
     data   : 'mydata=test' 
    }, 
    'padding'   : 0, 
    'overlayColor'  : '#333', 
    'overlayOpacity' : 0.2 
}); 

$("a#additional_trans").fancybox({ 
    ajax : { 
     type   : "POST", 
     data   : 'mydata=test' 
    }, 
    'padding'   : 0, 
    'overlayColor'  : '#333', 
    'autoDimensions' : false, 
    'titleShow'   : true, 
    'titlePosition'  : 'outside', 
    'title'    : 'Transact Online', 
    'width'    : '633', 
    'height'   : 'auto', 
    'overlayOpacity' : 0.2 
}); 

$("#modal_back_btn").live('click', function() { 
    // Not sure what to put here if indeed this is the correct place 
    // It needs to open $("a.trans").fancybox() 
}); 

回答

1

您應該能夠通過

$.fancybox.prev(); 

做到這一點。然而,你也可以做一個

$.fancybox.close(); 
$("a.trans").fancybox(); 

您單擊處理程序內。