2011-10-03 65 views

回答

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:在这个函数在一个div放在一个旋转.gif要点(为例),显示加载...