EasyUI Forum
November 02, 2025, 05:21:34 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: autofit for inline dialogs  (Read 13317 times)
iceh
Jr. Member
**
Posts: 61


View Profile
« on: November 12, 2013, 02:14:06 PM »

Hi,

I use a dialog that is inlined and fit is set to true.

When i rezize the browser window, i'd like to refit the dialog to the new dimensions.

Can anybody provide a script for this?

Thank you!
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: November 12, 2013, 07:51:49 PM »

If the dialog is in a region panel of layout, it will auto adjust its size. If the dialog is in your custom div container, you need to call 'resize' method after resize this div container.
Code:
$('#dlg').dialog('resize');
Logged
iceh
Jr. Member
**
Posts: 61


View Profile
« Reply #2 on: November 16, 2013, 02:44:44 PM »

That's cool!

How do i get the resize event in javascript of the top window?
Logged
iceh
Jr. Member
**
Posts: 61


View Profile
« Reply #3 on: November 28, 2013, 06:20:09 PM »

Code:
$(window).resize(function() {
    if(this.resizeTO) clearTimeout(this.resizeTO);
    this.resizeTO = setTimeout(function() {
        $(this).trigger('resizeEnd');
    }, 500);
});

$(window).bind('resizeEnd', function() {
    //reset to modal - because my dialog isn't resizable
    $('#dlg').dialog({ modal: true });
});

that did the trick!

the resize code is taken from here:

http://stackoverflow.com/questions/2996431/detect-when-a-window-is-resized-using-javascript
Logged
iceh
Jr. Member
**
Posts: 61


View Profile
« Reply #4 on: December 01, 2013, 06:11:40 AM »

I was looking for this:

Code:
$('#dlg').dialog('center');
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!