Scrolling to a specific element

4 posts, 0 answers
  1. Robin
    Robin avatar
    40 posts
    Member since:
    Jul 2012

    Posted 15 Oct 2013 Link to this post

    My view contains a lot of content, and I wish to give the user shortcuts to scroll to specific parts of the page.

    I see that it's possible to scroll using scrollTo, but the value has to be given as a number. As screen sizes vary I don't know the specific height values for the different places I wish to scroll.

    Is there a smart way to for example scroll to the element with id="ScrollPosition1"?
  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 16 Oct 2013 Link to this post

    Hello Robin,

    There is no built functionality that you can use to scroll to a specific element inside your application. However you might achieve something similar to this, by getting the offset position of the element according to the window and then use this value for the scrollTo() method.

    I have created an example showing a possible implementation:

    http://jsbin.com/UVALAqo/1/edit
     
    Regards,
    Kiril Nikolov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Robin
    Robin avatar
    40 posts
    Member since:
    Jul 2012

    Posted 17 Oct 2013 Link to this post

    This is great, thank you!
  5. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 17 Oct 2013 Link to this post

    Hi Robin,

    I am glad it helped.

    If you have any questions, please do not hesitate to contact us.
     
    Regards,
    Kiril Nikolov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top
Kendo UI is VS 2017 Ready