PDA

View Full Version : مشکل با setLocation در مرورگر کروم.



clover
سه شنبه 10 فروردین 1389, 16:22 عصر
با سلام
در Asp.net هنگام پست بک شدن آپدیت پنل قصد دارم یک لایه شفاف سیاه بر روی آپدیت پنل نمایش بدم. این کار را با نمایش یک div بر روی آپدیت پنل و تنظیم طول و عرض و مکان مطابق با آپدیت پنل انجام میدم. در همه مرورگر ها به درستی کار میکنه اما در گوگل کروم، div مورد نظر در مکان درستی قرار نمیگیره و در قسمت بالای صفحه میمونه.
آیا مشکل از گوگل کروم هست یا من موردی را رعایت نکردم ؟

function onUpdating(){
// get the update progress div
_backgroundDiv = $get('backgroundDiv');

// get the update progress div
_updateProgressDiv = $get('updateProgressDiv');

// get the _updatepanel element
_updatepanel = $get('<%= this.UpdatePanel1.ClientID %>');

// get the bounds of both the gridview and the progress div
_updatepanelBounds = Sys.UI.DomElement.getBounds(_updatepanel);

// do the math to figure out where to position the element (the center of the gridview)
var x = _updatepanelBounds.x + Math.round(_updatepanelBounds.width / 2) - 83;
var y = _updatepanelBounds.y + Math.round(_updatepanelBounds.height / 2) - 13;

// set the dimensions of the background div to the same as the gridview
_backgroundDiv.style.width = _updatepanelBounds.width + 'px';
_backgroundDiv.style.height = _updatepanelBounds.height + 'px';

// set the progress element to this position
Sys.UI.DomElement.setLocation (_updateProgressDiv, x, y);

// place the div over the gridview
Sys.UI.DomElement.setLocation(_backgroundDiv, _updatepanelBounds.x, _updatepanelBounds.y);

window.scrollTo(x - Math.round(_updatepanelBounds.width / 4) ,y - Math.round(_updatepanelBounds.height / 4));

// make it visible
_updateProgressDiv.style.display = 'block';
_backgroundDiv.style.display = 'block';
}