Hybrid View

  1. #1
    Ext User
    Join Date
    Nov 2007
    Posts
    4
    Vote Rating
    0
    nanobot27 is on a distinguished road

      0  

    Default "ExtJS" way to scroll the window

    "ExtJS" way to scroll the window


    Hi Guys

    Is there an "ExtJS" way to scroll the window (the "native" browser window)

    In normal JS it would look like:

    Code:
    function getScrollXY() {
      var scrOfX = 0, scrOfY = 0;
      if( typeof( window.pageYOffset ) == 'number' ) {
        //Netscape compliant
        scrOfY = window.pageYOffset;
        scrOfX = window.pageXOffset;
      } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
        //DOM compliant
        scrOfY = document.body.scrollTop;
        scrOfX = document.body.scrollLeft;
      } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
        //IE6 standards compliant mode
        scrOfY = document.documentElement.scrollTop;
        scrOfX = document.documentElement.scrollLeft;
      }
      return [ scrOfX, scrOfY ];
    }

    Thank you

  2. #2
    Ext User
    Join Date
    Nov 2007
    Posts
    4
    Vote Rating
    0
    nanobot27 is on a distinguished road

      0  

    Post


    Hey Guys

    I found the answer to my question. Just in case someone else battles with this - it's really easy

    Code:
    var body = Ext.get('docBody');  // add id docBody to your HTML ie. <body id="docBody"> 
                                               // or use DomQuery to get the body tag
    
    body.scrollTo('top', 67);
    Check out Extjs API for Element and also look at the function scroll

  3. #3
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,483
    Vote Rating
    34
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Ext.getBody() return the document body Element.

  4. #4
    Sencha User
    Join Date
    Jun 2012
    Posts
    82
    Vote Rating
    1
    dr-dan is on a distinguished road

      0  

    Default


    Ext is only javascript after-all, so, just call native:

    Code:
    window.scrollTo(0, 0);
    That worked for me.

    Code:
    Ext.getBody().scrollTo('top', 0);
    did nada.

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar