Monday 26 August 2013

Dynamical positioning of a Div

Dynamical positioning of a Div

I've got the following construct
Text Details
Show Details
Text
Show Details ...
When i press now Show Details I want the details appear on the same height
as the pressed link. (Imagine 100 Text/Links.)
I've put together a small JSfiddle where the absolute positioning of the
element is possible, but somehow I can't get it to work dynamically based
on the scrollposition. http://jsfiddle.net/uRN64/201/
I have tried the following javascript functions to set the position:
var div = document.getElementById('update');
//div.style.top = window.pageYOffset;
//div.style.top = document.body.parentElement.scrollTop;
//div.style.top = document.body.scrollTop;
div.style.top = '100px';

No comments:

Post a Comment