Self Adjusting Floating RadDocks

2 posts, 0 answers
  1. Virgil Rodriguez
    Virgil Rodriguez avatar
    70 posts
    Member since:
    Oct 2008

    Posted 22 May 2012 Link to this post

    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
  2. Slav
    Admin
    Slav avatar
    1356 posts

    Posted 24 May 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top