ورود

View Full Version : سوال: استفاده از Loading در Initial Load صفحه



bftarane
سه شنبه 05 دی 1391, 16:21 عصر
سلام.
من مي خوام از اين لودينگي که آموزش داده شده استفاده کنم
ولي مشکلاتي باهاش دارم
من هر دکمه اي که کليک مي کنم اين لودينگ شروع به کار مي کنه
چه کار کنم فقط دفعه اول که سايت لود ميشه عمل کنه؟

اين کدهاي رويداد لود صفحه

if (!IsPostBack)
{
string script = "$(document).ready(function () { $('[id*=btnSubmit]').click(); });";
ClientScript.RegisterStartupScript(this.GetType(), "load", script, true);
}

<style type="text/css">
.modal
{
position: fixed;
top: 0;
left: 0;
background-color: black;
z-index: 99;
opacity: 0.8;
filter: alpha(opacity=80);
-moz-opacity: 0.8;
min-height: 100%;
width: 100%;
}
.loading
{
font-family: Arial;
font-size: 10pt;
border: 5px solid #67CFF5;
width: 200px;
height: 100px;
display: none;
position: fixed;
background-color: White;
z-index: 999;
}
</style>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
function ShowProgress() {
setTimeout(function () {
var modal = $('<div />');
modal.addClass("modal");
$('body').append(modal);
var loading = $(".loading");
loading.show();
var top = Math.max($(window).height() / 2 - loading[0].offsetHeight / 2, 0);
var left = Math.max($(window).width() / 2 - loading[0].offsetWidth / 2, 0);
loading.css({ top: top, left: left });
}, 200);
}
$('form').live("submit", function () {
ShowProgress();
});
</script>
اينم لينک منبع:
http://aspsnippets.com/Articles/Display-loading-progress-image-when-Page-Loads-or-does-PostBack-using-ASPNet.aspx

ممنون ميشم اگه اين کد رو هم توضيح بديد
$('form').live("submit", function () {
اون live اينجا چه کار مي کنه؟ و به جاي submit چه مقادير ديگه اي ميشه اون قسمت گذاشت؟

imanitc
سه شنبه 27 فروردین 1392, 08:49 صبح
خيلي سادس توي گفته وقتي فرم سابميت شد تابع نمايش لودينگ رو صدا بزن
$('form').live("submit", function () { ShowProgress();
});