PDA

View Full Version : Get and set position of content



B.Altmann
03-17-2017, 09:46 AM
1) Script Title: Scrollable content script v2.0

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex11/scrollc2.htm

3) Describe problem: I want to use a scrollable content in an html-form. Is it possible to get information of the position of the content and set the position for the next display of the form? After submit the form and display the form again, the content should have the old position.
Bernd

jscheuer1
03-18-2017, 08:11 AM
The belt divisions can apparently be accessed directly via jQuery and their left or top css obtained or set. For the the vertical one:


$('.belt').css('top')

will get you the position and:


$('.belt').css('top', '-120px')

will set it.

It's similar for the horizontal one, only you use 'left' instead of 'top' in the above examples. If you have more than one scrollable feature on the page, you need to specify which one you want. They are indexed from 0 to however many there are, so to get the second one, if it's horizontal, you would do:


$('.belt').eq(1).css('left')