2011-10-03 2 views
0

POST 요청의 결과로 fancybox를 표시하기 위해 this brilliant solution을 사용하고 있습니다.jQuery는 Ajax 통화로 fancybox를 사용자 정의합니다.

문제는 fancybox 동작을 사용자 정의하는 방법을 모르겠다는 것입니다.

아약스를 수행하는 동안 회전 애니메이션 (또는 이와 유사한)을 표시하는 방법은 무엇입니까?

제목을 설정하는 방법/fancybox의 내용을 (양식화 된) html로 표시하는 방법은 무엇입니까?

답변

2
function formatTitle(title, currentArray, currentIndex, currentOpts) { 
    return '<div id="tip7-title"><span><a  
    href="javascript:;"onclick="$.fancybox.close();"><img src="/data/closelabel.gif" />  
    </a></span>' + (title && title.length ? '<b>' + title + '</b>' : '') + 'Image ' + 
    (currentIndex + 1) + ' of ' + currentArray.length + '</div>'; 
} 


function showResponse(responseText){ 
    //first of all hide the spinning animation div 
    //then process the response as you like 
    $.fancybox({ 
      'content'    : responseText, 
     'titlePosition'  : 'inside', 
     'titleFormat'  : formatTitle 
      }); 
    } 

function showspinningAnimation(iddiv_container){ 
    //this function is called before the ajax call  
    //put your animation spinning or whatever in a div 
} 

var options = {  
    beforeSubmit: showRequest, // pre-submit callback 
    success:  showResponse 
}; 

$(document).ready(function() { 
    $("#myForm").ajaxForm(options);   
});  

설명 :

formatTitle :이 기능 형식으로 귀하의 fancybox showspinningAnimation의 제목 : 사업부에서 (예를 들어) 회전 .gif 참고를 넣어이 함수에서이 로딩을 보여주는 ...

관련 문제