Link to home
Start Free TrialLog in
Avatar of Brad Bansner
Brad Bansner

asked on

how to retrieve value of "top" on an element

I'm moving the element displayscreens around and need to know if it exceeds a certain amount (see code attached). So I'm trying to read the value of "top" like this:

if ($('#displayscreens').attr('top')==2484)

But it isn't working. So I added an alert:


That keeps telling me "undefined". How can I figure the "top" value so I know how far the user has moved #displayscreens? Thank you!
	if ($('#displayscreens').attr('top')==2484) {
	} else {
		$('#displayscreens').animate({top: '+=414px'}, 1000);

Open in new window

Avatar of Tom Beck
Tom Beck
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Brad Bansner
Brad Bansner


Excellent, thanks!
You're welcome, thanks for the points.