Results 1 to 3 of 3

Thread: page postback and scrollTop (issue in FF)

  1. #1
    Join Date
    Jun 2009

    page postback and scrollTop (issue in FF)


    I have got a DIV with a scroll ( overflow: scroll) in an aspx page and when page is post back the scroll is reset to top position. So I try to set back to the position before the post back, but I found an issue in FF.

    (I remove all the logic to reproduce this issue)

    Basically I register a function on the AJAX end request:


    In this functionI try to set the scroll of the div

    var t = document.getElementById(tmp);
    t.scrollTop = 250;

    The div is long enough (for this example) and this code working fine in IE, so the div scroll to 250 and if I try to read t.scroll (with a button after the page has finised reloading), it returns 250. In FF, it scrolls to 45, but if I try less than 45 it scrolls fine (so if I set t.scrollTop = 30; then it scrolls to 30).

    What I found is if I put an alert() before it works fine in FF as well!!

    var t = document.getElementById(tmp);
    t.scrollTop = 250;

    Someone said to put "px" (t.scrollTop = 250 + "px"), but it isnt working at all.

    Could somebody help me?

    Thank you

  2. #2
    Join Date
    Jun 2009


    I found that is something related with the css.. I was trying to reproduce in a test page and only when I put my web.config it started not working.
    So the only difference is <pages theme=".."> in web.config, so with simple text/links with no CSS is's working fine even in FF.
    I'm working on understand why at the moment but if someone has any idea...

    thank you

  3. #3
    Join Date
    Jun 2009


    I attached the aspx page, I you try without

    <style type="text/css">
    font-size: 12px;

    it's working fine in IE and FF, but if you put it back in FF is not setting the right position. If you put an alert before

    var t = document.getElementById("divContainer");
    t.scrollTop = scrollX;

    it's working even in FF.
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center