Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #19972

Re: Scroll position detection

From Joao Rodrigues <groups_jr-1@yahoo.com.br>
Newsgroups comp.lang.javascript
Subject Re: Scroll position detection
Date 2013-05-27 09:45 -0300
Organization Aioe.org NNTP Server
Message-ID <knvkho$m3a$1@speranza.aioe.org> (permalink)
References <knq2it$m8o$1@news.albasani.net> <XnsA1CB865D2BD6Aeejj99@194.109.133.133> <knum6d$7iu$1@speranza.aioe.org> <knvbqb$gvn$2@dont-email.me>

Show all headers | View raw


On 27/05/2013 07:16, Denis McMahon wrote:
> On Mon, 27 May 2013 01:07:41 -0300, Joao Rodrigues wrote:
>
>> The W3C standard is pageYOffset:
>> <http://www.w3.org/TR/cssom-view/#dom-window-pageyoffset>
>>
>> Also see:
>> <http://www.quirksmode.org/dom/w3c_cssom.html>
>>
>> and <https://developer.mozilla.org/en-US/docs/Web/API/window.scrollY>
>>
>> So, nowadays we need to test for pageYOffset before testing for the
>> proprietary scrollTop. E.g
>
> Hmm, tried that, ff 21 under linux ubuntu 12.04.2 lts, and none of them
> seem to give any data.
>
>      function xyPos() {
>          var str = "";
>          if ( window.pageXOffset || window.pageYOffset )
>              str += "[ " +
>                     window.pageXOffset +
>                     ", " +
>                     window.pageYOffset +
>                     " ] from window.pageX/YOffset\n";
>          if ( document.documentElement &&
>               ( document.documentElement.scrollLeft ||
>                 document.documentElement.scrollTop ) )
>              str += "[ " +
>                     document.documentElement.scrollLeft +
>                     ", " +
>                     document.documentElement.scrollTop +
>                     " ] from document.documentElement.scrollLeft/Top\n";
>          if ( document.body &&
>               ( document.body.scrollLeft ||
>                 document.body.scrollTop ) )
>              str += "[ " +
>                     document.body.scrollLeft +
>                     ", " +
>                     document.body.scrollTop +
>                     " ] from document.body.scrollLeft/Top\n";
>          if ( str == "" )
>              str = "no xy data found";
>          alert( str );
>      }
>

Hi,
Strange, I've been using pageYOffset since Feb 2011 and haven't found 
problems in FF since then. Maybe you haven't scrolled the page downwards 
before executing the code...

Cheers,
Joao Rodrigues

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Scroll position detection Tuxedo <tuxedo@mailinator.com> - 2013-05-25 12:08 +0200
  Re: Scroll position detection "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-05-25 13:12 +0200
    Re: Scroll position detection Tuxedo <tuxedo@mailinator.com> - 2013-05-25 16:02 +0200
    Re: Scroll position detection Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-05-27 01:07 -0300
      Re: Scroll position detection Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-27 11:48 +0200
        Re: Scroll position detection Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-05-27 09:33 -0300
          Re: Scroll position detection Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-27 14:39 +0200
            Re: Scroll position detection Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-05-27 11:33 -0300
              Re: Scroll position detection Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-27 16:42 +0200
          Re: Scroll position detection Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-27 12:37 +0000
            Re: Scroll position detection Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-05-27 09:57 -0300
              Re: Scroll position detection Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-27 16:45 +0200
                Re: Scroll position detection Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-05-27 11:58 -0300
                Re: Scroll position detection Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-27 17:27 +0200
                Re: Scroll position detection Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-05-27 13:12 -0300
                Re: Scroll position detection Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-27 19:41 +0200
                Re: Scroll position detection Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-05-27 15:24 -0300
                Re: Scroll position detection Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-27 21:10 +0200
                Re: Scroll position detection Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-05-27 18:35 -0300
                Re: Scroll position detection Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-28 00:00 +0200
                Re: Scroll position detection Stefan Weiss <krewecherl@gmail.com> - 2013-05-28 02:30 +0200
      Re: Scroll position detection Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-27 10:16 +0000
        Re: Scroll position detection Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-05-27 09:45 -0300
          Re: Scroll position detection Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-27 21:24 +0000

csiph-web