关于Jquery在ajax交互时显示Loading.:1。设置一个Div容器(假设ID为LoadingPanel,其display为none 2。设置$(#LoadingPanel).ajaxStart(function() { //这里设置LoadingPanel的显示.最好使用鼠标位置取得坐标,然后绝对定位,这样不管Scroll到哪都能看到Loading }); 3。$(#LoadingPanel).ajaxEnd(function(){$(this).hide();}); 4。将以上方法放在document.ready的时候执行. Jquery官方网站资料

吕的部落格唯女子与小人为难养也近之则不孙远之则怨

关于Jquery在ajax交互时显示Loading.

1。设置一个Div容器(假设ID为LoadingPanel,其display为none
2。设置$("#LoadingPanel").ajaxStart(function()
{
//这里设置LoadingPanel的显示.最好使用鼠标位置取得坐标,然后绝对定位,这样不管Scroll到哪都能看到Loading
});

3。$("#LoadingPanel").ajaxEnd(function(){$(this).hide();});
4。将以上方法放在document.ready的时候执行.

jquery官方网站资料:

ajaxStart( callback )

Attach a function to be executed whenever an AJAX request begins and there is none already active.

Return value: jquery
Parameters:

  • callback (Function): The function to execute.

Example:

Show a loading message whenever an AJAX request starts (and none is already active).

 $("#loading").ajaxStart(function(){
$(this).show();
});

ajaxStop( callback )

Attach a function to be executed whenever all AJAX requests have ended.

Return value: jquery
Parameters:

  • callback (Function): The function to execute.

Example:

Hide a loading message after all the AJAX requests have stopped.

 $("#loading").ajaxStop(function(){
$(this).hide();
});
所属分类:随笔标签:无 关于Jqueryajax交互显示Loading. 吕 @ 2007年6月22日8点17分 AM 编辑 关于Jquery在ajax交互时显示Loading.阅读(2547) 评论(0)

相关文章

数据加载中,请稍候……