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

Self Adjusting Floating RadDocks

1 Answer 42 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Virgil Rodriguez
Top achievements
Rank 1
Virgil Rodriguez asked on 22 May 2012, 11:18 PM
Hello Telerik,

Is there a way to make floating RadDocks self-adjust its' Top and Left properties when the size of the window changes? Maybe, programatically change these properties relative to an enclosing "box" or area in response to a window-size-changed event?

Thanks for any input.

Virgil

1 Answer, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 24 May 2012, 03:54 PM
Hi Virgil,

You can achieve this via the client-side API of RadDock. The methods set_top and set_left are used for dynamically changing the position of a floating dock control. In addition to this, you can use the method getBounds from the Telerik static client library to get the size and the coordinates of the HTML element according to which the dock control will be repositioned on page resize.

The following model will help you create your script:
$telerik.$(window).resize(function () {
    var dock = $find("<%=RadDock1.ClientID %>");
    var element = $get("element");
    var elementBounds = $telerik.getBounds(element);
    dock.set_top(elementBounds.y + 20);
    dock.set_left(elementBounds.x + 30);
});

Note that the coordinates of the RadDock and the HTML element, used in the example, depend on your setup and the effect that you want to achieve.

I hope this helps. Feel free to contact us again if you run into more difficulties. 

Regards,
Slav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Dock
Asked by
Virgil Rodriguez
Top achievements
Rank 1
Answers by
Slav
Telerik team
Share this question
or