Skip to main content
Participating Frequently
November 10, 2008
Question

Automatic scrolling on page load

  • November 10, 2008
  • 5 replies
  • 872 views
Quick question...has anybody ever ran into an issue with a cfm page where the page loads in scrolled down automatically? If so, how did you handle it? The page that is doing this for me has a cfform tag and a few includes on it. It's not really that big of a deal, but it's a pretty annoying. I have compared my code for the app that is doing this to several other apps I've created and I see no significant differences. I don't really want to get into specifics if possible...just prodding around to see if anyone else has run into this.

Thanks for the help and feedback!
    This topic has been closed for replies.

    5 replies

    Inspiring
    November 11, 2008
    Hi,

    If the submit button is the problem then the issue may be related to tabindex. The browser may scroll down to the submit button because it is the default element in the form.
    Can you assign tabindex=1 to an item on top of the form?

    - fober

    Inspiring
    November 11, 2008
    Hi,

    Does the URL or the link you are using include any "#" symbols?
    If you have an anchor somewhere on the page, and a # symbol with the anchor name somewhere in the URL, it would scroll directly to the anchor.

    cheers,
    fober

    Participating Frequently
    November 11, 2008
    There are no pounds in the link, and no named anchors on the page, so that's out, but thanks for the suggestion.

    It's not a scrolling problem with firefox either, but I have isolated the problem by commenting code out progressively. It seems like CF doesn't like something about my cfinput type="submit" tag. I do appreciate every suggestion made!

    Thanks again!
    November 10, 2008
    Could it be scrolling to the part in the page you last were?

    For example, right now as I type into this box, If i refresh the page, it will jump back down to where I was. I've only noticed this in firefox but it could be a "feature" in other browsers too.

    Try setting the page to the top then refreshing, does it still scroll / jump down?

    I'm out of ideas after this! Haha.

    Mikey.
    Inspiring
    November 10, 2008
    I've had it happen to me. However, it's been awhile and my memory is vague at the best of times. I think it has something to do with setting the focus on a formfield that is kinda far down the page.
    November 10, 2008
    You wouldn't be able to make your browser scroll directly with CFML, that would be JavaScript, since JavaScript can mainly handle client-side functionality e.g. browser scrolling, size, colours etc.

    Maybe it's something to do with settings in your browser? Or, does the page CFFLUSH? Not sure what effect a progressive output of a large dataset would do to the page - this shouldn't be a problem though.

    Do you have a dodgy conflict with the mouse and your possible laptop mouse pad? I know that both of mine work at the same time, which sometimes messes up scrolling.

    Has this problem persisted over several sessions, or just occurred the once?

    Mikey.
    Participating Frequently
    November 10, 2008
    No CFFLUSH. It occurs every time the page is loaded (even with different sessions). It's not the keyboard and/or mouse, as it happens across different browsers and on different machines.

    Dan may be correct, however, I don't believe that I'm setting form field focus. I'll have to look into it...I was suspicious that it might have something to do with the form or the includes, but I'm pretty sure that focus isn't being set in the form fields or in any of the includes. I'll double check, though. Thanks for your feedback, guys. I appreciate it.