Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    18
    Vote Rating
    0
    zhaoshixuan is on a distinguished road

      0  

    Default Can't get scrollTop in Chrome

    Can't get scrollTop in Chrome


    Hi, I use floating panel and need to set its position according to the browser's scrollTop.
    In FF, I can use Ext.getBody().dom.scrollTop or document.documentElement.scrollTop to get this value.
    But in Chrome, I used Ext.getBody().dom.scrollTop, document.documentElement.scrollTop and document.body.scrollTop. None of them works.
    Could anyone have this solution?
    Thanks!
    BTW: I tested on Ext3.3's examples, and it didn't work either

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,111
    Vote Rating
    470
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Please provide a small test case for us to review.

    Scott.

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    18
    Vote Rating
    0
    zhaoshixuan is on a distinguished road

      0  

    Default


    Maybe there is something wrong in our project.
    I tried it with original ext, there is no such problem.

  4. #4
    Sencha User
    Join Date
    Oct 2011
    Posts
    18
    Vote Rating
    0
    zhaoshixuan is on a distinguished road

      0  

    Default


    Quote Originally Posted by scottmartin View Post
    Please provide a small test case for us to review.

    Scott.
    Hi Scott,
    I found the reason.
    If I use viewport as the page body, this situation will appear in Chrome.
    Any suggestion?
    You can use the sample below:
    Code:
    <%@ page language="java" contentType="text/html; charset=utf-8"    pageEncoding="utf-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" type="text/css" href="js/ext-3.3.0/ext-3.3.0/resources/css/ext-all.css"/>
    <script type="text/javascript" src="js/ext-3.3.0/ext-3.3.0/adapter/ext/ext-base-debug.js"></script>
    <script type="text/javascript" src="js/ext-3.3.0/ext-3.3.0/ext-all-debug.js"></script>
    <title>Insert title here</title>
    <script type="text/javascript">
    Ext.onReady(function(){
    	var panel = new Ext.FormPanel({
    		height : 2000,
    		title : 'test',
    		width:300,
    		autoScroll : true
    	});
    	var view = new Ext.Viewport({
    		renderTo : 'body',
    		items : [panel],
    		autoScroll : true,
    		layout : 'border'
    	});
    });
    </script>
    </head>
    <body id="body">
    
    
    </body>
    </html>

  5. #5
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,111
    Vote Rating
    470
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    I will have to test in the morning .. few issues:
    remove the renderTo .. viewport will always default to the entire browser
    remove autoScroll.. assign this to the containers in viewport

    See if this helps.

    Scott.

  6. #6
    Sencha User
    Join Date
    Oct 2011
    Posts
    18
    Vote Rating
    0
    zhaoshixuan is on a distinguished road

      0  

    Default


    Quote Originally Posted by scottmartin View Post
    I will have to test in the morning .. few issues:
    remove the renderTo .. viewport will always default to the entire browser
    remove autoScroll.. assign this to the containers in viewport

    See if this helps.

    Scott.
    Well, they don't work, either.
    And if I remove autoScroll, the scroll bar will disappear and the bottom will never be seen.
    I also found same problem in Ext 4.0.7-gpl
    Code:
    Ext.require([    'Ext.form.*',
        'Ext.layout.container.Absolute',
        'Ext.window.Window'
    ]);
    
    
    Ext.onReady(function() {
        var form = Ext.create('Ext.form.Panel', {
            defaultType: 'textfield',
            border: true,
            height : 2000,
            title : 'test',
            autoScroll : true
        });
    
    
        var win = Ext.create('Ext.container.Viewport', {
            
            height: 850,
            //plain:true,
            items: form,
            autoScroll : true
        });
    
    
    });

  7. #7
    Sencha User
    Join Date
    Oct 2011
    Posts
    18
    Vote Rating
    0
    zhaoshixuan is on a distinguished road

      0  

    Default


    Could some one do me a favor?
    I really think it is a problem.
    Please help resolve compatible problem among different browsers.
    Thanks!

Thread Participants: 1