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

Scrolling to a specific element

3 Answers 167 Views
Application
This is a migrated thread and some comments may be shown as answers.
Robin
Top achievements
Rank 1
Robin asked on 15 Oct 2013, 09:18 AM
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"?

3 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 16 Oct 2013, 12:54 PM
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!
0
Robin
Top achievements
Rank 1
answered on 17 Oct 2013, 06:01 AM
This is great, thank you!
0
Kiril Nikolov
Telerik team
answered on 17 Oct 2013, 06:14 AM
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!
Tags
Application
Asked by
Robin
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Robin
Top achievements
Rank 1
Share this question
or