troubleshooting Question

how to retrieve value of "top" on an element

Avatar of Brad Bansner
Brad Bansner asked on
jQueryJavaScript
3 Comments1 Solution221 ViewsLast Modified:
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:

lert($('#displayscreens').attr('top'));

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

Open in new window

ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros