Hi, Richard, and thanks for the reply.

 

I had tried that very approach with this line:

 

var scrollTopPosition = $(window).scrollTop();

 

but when I run the code (full code below), I get

an error in Firebug that "$(window).scrollTop(); is not a function"

 

Well.I just found the answer.  I was using an older version of jQuery

that I have in a "misc" folder for code tests.  Apparently .scrollTop();

wasn't a function in that version.

 

Thanks for verifying an approach I took, causing me to dig harder

for the answer!

 

Rick

 

From: [email protected] [mailto:[email protected]] On
Behalf Of Richard D. Worth
Sent: Tuesday, August 11, 2009 2:14 AM
To: [email protected]
Subject: [jQuery] Re: Is there a way to determine the scrollTop position of
the top of the viewport?

 

var scrollTop = $(window).scrollTop();

 

- Richard

On Mon, Aug 10, 2009 at 9:28 PM, Rick Faircloth <[email protected]>
wrote:

I'm trying to position a div that's used as a modal window 50px from the top
of the

current viewport, no matter where the page currently is scrolled to.

 

I found "getScrollTop();", but couldn't make that work.

 

I checked out jQuery's "scrollTop", but that get the y position or offset of
a matched

element.

 

Suggestions on how to dynamically calculate this?

 

Thanks,

 

Rick

 

----------------------------------------------------------------------------
------------------------------------------

"Ninety percent of the politicians give the other ten percent a bad
reputation."  - Henry Kissinger

 

 

Reply via email to