This is a migrated thread and some comments may be shown as answers.

Window size after resizing

3 Answers 97 Views
Window
This is a migrated thread and some comments may be shown as answers.
erniej
Top achievements
Rank 1
erniej asked on 02 Sep 2008, 03:41 AM
Good Morning,

I am wanting to obtain the height and width of a RadWindow in client side javascript, after the window has been resized by the user.

My current code handles the OnResize event of the window as follows

function SetMapSize(sender, EventArgs)
{
    var width = sender.get_width();
    var height = sender.get_height();
}

Unfortunately this returns only the original size of the window not the new size after resizing. 

Much appreciated.

Ernie Josefik




}

3 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 02 Sep 2008, 09:01 AM
Hello Ernie,

Indeed, as noted in the documentation, these methods will return the initial size only. To get the current one, you must use the getWindowsBounds() method - more information on it is available in the same documentation's page.



Regards,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Shinu
Top achievements
Rank 2
answered on 02 Sep 2008, 09:13 AM
Hi,

Try the following JavaScript code.

JS:
 <script type="text/javascript" language="javascript" > 
     function OnClientResize(oWnd) 
     { 
      var bounds = oWnd.getWindowBounds(); 
      alert(bounds.x) 
      alert(bounds.y) 
      
     } 
      
    </script> 


Thanks
Shinu
0
erniej
Top achievements
Rank 1
answered on 02 Sep 2008, 07:49 PM
Thank you George and Shinu,

For some unexplicable reason I looked everywhere in the Documentation and on the forums except the correct page.

I've now tried getWindowsBounds() and it seems to return the external dimensions of the window (i.e. including scroll bars, title bar and status bar).  Looking into the properties of the object returned by the getContentFrame() method I found clientWidth and clientHeight.  These seem to return the correct size of the content section of the window so I have ended up using these.

Cheers

Ernie

 

Tags
Window
Asked by
erniej
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Shinu
Top achievements
Rank 2
erniej
Top achievements
Rank 1
Share this question
or