javascript - Simulate browser resize on page first load - Stack Overflow

I have a dashboard web application. It contains some controls on it which are sized based on the browse

I have a dashboard web application. It contains some controls on it which are sized based on the browser and are also resizeable by the user. They are dynamically created and, as such, I persist their dimensions through page postbacks by storing their state in Session and in a database.

When my dashboard first loads there is a chance that I am pulling data out of the Database onto a monitor which is not the same size as when the data was written to the Database. The controls need to be resized proportional to how they were before. Fortunately, it appears that the controls are able to resize themselves to the correct, proportional dimensions if they believe they need to re-calculate their dimensions.

As such, on first page load, I would like to simulate the browser resizing. Is it possible to do something like this in javascript?

I have a dashboard web application. It contains some controls on it which are sized based on the browser and are also resizeable by the user. They are dynamically created and, as such, I persist their dimensions through page postbacks by storing their state in Session and in a database.

When my dashboard first loads there is a chance that I am pulling data out of the Database onto a monitor which is not the same size as when the data was written to the Database. The controls need to be resized proportional to how they were before. Fortunately, it appears that the controls are able to resize themselves to the correct, proportional dimensions if they believe they need to re-calculate their dimensions.

As such, on first page load, I would like to simulate the browser resizing. Is it possible to do something like this in javascript?

Share Improve this question asked Aug 8, 2011 at 22:50 Sean AndersonSean Anderson 29.4k33 gold badges132 silver badges242 bronze badges 2
  • 2 If using jQuery it's as easy as $(window).resize();. – Marcel Commented Aug 8, 2011 at 22:52
  • 2 @marcel in javascript is as easy as window.onresize(); – amosrivera Commented Aug 8, 2011 at 22:55
Add a ment  | 

1 Answer 1

Reset to default 6

The controls probably resize on window.onresize event. If you want to trigger this event you can do window.onresize(); after the page loads.

To wait for the apge to load you can add it to the window.onload event.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742267455a4412070.html

相关推荐

  • javascript - Simulate browser resize on page first load - Stack Overflow

    I have a dashboard web application. It contains some controls on it which are sized based on the browse

    3天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信