0
我使用this brilliant solution来显示作为POST请求结果的fancybox。jQuery使用ajax调用定制fancybox
问题是我不知道如何自定义fancybox行为。
如何在执行ajax时显示旋转动画(或类似)?
如何设置标题/显示fancybox的内容为(风格化)html?
我使用this brilliant solution来显示作为POST请求结果的fancybox。jQuery使用ajax调用定制fancybox
问题是我不知道如何自定义fancybox行为。
如何在执行ajax时显示旋转动画(或类似)?
如何设置标题/显示fancybox的内容为(风格化)html?
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要点(为例),显示加载...