如何同时使用Jquery在DIV加载页面显示进度条 [英] How to show Progress bar while loading page in div using Jquery

查看:336
本文介绍了如何同时使用Jquery在DIV加载页面显示进度条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jQuery.Load加载其他页面在一个DIV(#DIVID,PAGEURL);

我有锚标签点击我打电话jQuery.load锚标记(#DIVID,PAGEURL);功能该功能需要一定的时间在该分区加载页面​​,所以我想显示加载图像和改变光标样式。

下面是我使用目前code片段。
在文件的script.js我写了这样的功能。

 函数loadReview(EL){    jQuery的(#productName1)负荷(EL)。    返回false;
}

和我有一个这样的.aspx页面中的锚标记。

 <一的onclick ='loadReview(\\+ strexternalURL +\\); HREF ='#productName1'>&下; / A>


解决方案

使用方法的成功。

 函数loadReview(EL){
    $(div.loaderDiv)HTML。('< IMG SRC =imglink/>');
    $(div.loaderDiv)显示()。    $(#productName1)负荷(EL)。    返回false;    成功:$(div.loaderDiv),隐藏();
}

I am loading another page in one div using jQuery.Load("#divid","pageURL");

I have anchor tag on that anchor tag click I am calling jQuery.load("#divid","pageURL"); function this function takes time to load page in that div, so I want to show loading image and changing the cursor style.

Below is the code snippet which I am using currently. in script.js file I have written function like that

function loadReview(el) {

    jQuery("#productName1").load(el);

    return false;
}

and I have anchor tag inside .aspx page like that.

<a onclick='loadReview(\"" + strexternalURL + "\");' href='#productName1'></a>

解决方案

Use success method

function loadReview(el) {
    $("div.loaderDiv").html('<img src="imglink" />');
    $("div.loaderDiv").show();

    $("#productName1").load(el);

    return false;

    success: $("div.loaderDiv").hide();
}

这篇关于如何同时使用Jquery在DIV加载页面显示进度条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆