Reset a DIV - scroll to top

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joe

    Reset a DIV - scroll to top

    I have a very simple need - I need javascript code to reset a DIV that
    the user may have scrolled down. It doesn't need to smoothly scroll or
    anything - just jump right to the top.

    All help gratefully received.
    Joe
  • Pieter Van Waeyenberge

    #2
    Re: Reset a DIV - scroll to top

    depending on your specific context the solution maybe less or more complex
    ;-)

    anyway ... perhaps one of the good old 2.0 tricks: <a
    href="#target"> top</a><a name="target"></a>


    Pieter.

    "Joe" <jbloggs2002@ho tmail.com> wrote in message
    news:6448d58f.0 402090616.471a0 70c@posting.goo gle.com...[color=blue]
    > I have a very simple need - I need javascript code to reset a DIV that
    > the user may have scrolled down. It doesn't need to smoothly scroll or
    > anything - just jump right to the top.
    >
    > All help gratefully received.
    > Joe[/color]


    Comment

    • Joe

      #3
      Re: Reset a DIV - scroll to top

      But wouldn't that require the user to click?

      I want to be able to reuse a DIV that a user may already have
      activated on the page and scrolled down once.
      If I hide it, then re-show it, it is still scrolled down. I want a way
      to scroll it to the top every time it is hidden or shown.


      "Pieter Van Waeyenberge" <p@foo.com> wrote in message news:<4027c8f3$ 0$310$ba620e4c@ news.skynet.be> ...[color=blue]
      > depending on your specific context the solution maybe less or more complex
      > ;-)
      >
      > anyway ... perhaps one of the good old 2.0 tricks: <a
      > href="#target"> top</a><a name="target"></a>
      >
      >
      > Pieter.
      >
      > "Joe" <jbloggs2002@ho tmail.com> wrote in message
      > news:6448d58f.0 402090616.471a0 70c@posting.goo gle.com...[color=green]
      > > I have a very simple need - I need javascript code to reset a DIV that
      > > the user may have scrolled down. It doesn't need to smoothly scroll or
      > > anything - just jump right to the top.
      > >
      > > All help gratefully received.
      > > Joe[/color][/color]

      Comment

      • Rene Nyffenegger

        #4
        Re: Reset a DIV - scroll to top

        [color=blue]
        > But wouldn't that require the user to click?
        >
        > I want to be able to reuse a DIV that a user may already have
        > activated on the page and scrolled down once.
        > If I hide it, then re-show it, it is still scrolled down. I want a way
        > to scroll it to the top every time it is hidden or shown.
        >
        >
        > "Pieter Van Waeyenberge" <p@foo.com> wrote in message news:<4027c8f3$ 0$310$ba620e4c@ news.skynet.be> ...[color=green]
        >> depending on your specific context the solution maybe less or more complex
        >> ;-)
        >>
        >> anyway ... perhaps one of the good old 2.0 tricks: <a
        >> href="#target"> top</a><a name="target"></a>
        >>
        >>
        >> Pieter.
        >>
        >> "Joe" <jbloggs2002@ho tmail.com> wrote in message
        >> news:6448d58f.0 402090616.471a0 70c@posting.goo gle.com...[color=darkred]
        >> > I have a very simple need - I need javascript code to reset a DIV that
        >> > the user may have scrolled down. It doesn't need to smoothly scroll or
        >> > anything - just jump right to the top.
        >> >
        >> > All help gratefully received.
        >> > Joe[/color][/color][/color]


        Not sure if it is this what you're after:


        ---------8<--------8<--------8<--------


        <script language='javas cript'>

        function move_up() {
        scroll_clipper. scrollTop = 0;
        }

        </script>

        <a href='javascrip t:move_up()'>Mo ve UP</a>

        <p>

        <div id='scroll_clip per'
        style='position :absolute; width:150px; height: 150px; overflow:auto'>
        <div id='scroll_text ' style='backgrou nd-color:yellow'>
        Here is some content that can be scrolled.
        <p>It uses two divs:<ul>
        <li>scroll_clip per, and
        <li>scroll_te xt
        </ul>

        scroll_clipper defines the scroll area while scroll_text
        defines the text to be scrolled.

        </div>
        </div>

        ---------8<--------8<--------8<--------

        hth
        Rene

        --
        Rene Nyffenegger

        Comment

        • Joe

          #5
          Re: Reset a DIV - scroll to top

          That's exactly what I wanted - thanks!!


          Rene Nyffenegger <rene.nyffenegg er@gmx.ch> wrote in message news:<c0a3p1$15 b87p$1@ID-82536.news.uni-berlin.de>...[color=blue][color=green]
          > > But wouldn't that require the user to click?
          > >
          > > I want to be able to reuse a DIV that a user may already have
          > > activated on the page and scrolled down once.
          > > If I hide it, then re-show it, it is still scrolled down. I want a way
          > > to scroll it to the top every time it is hidden or shown.
          > >
          > >
          > > "Pieter Van Waeyenberge" <p@foo.com> wrote in message news:<4027c8f3$ 0$310$ba620e4c@ news.skynet.be> ...[color=darkred]
          > >> depending on your specific context the solution maybe less or more complex
          > >> ;-)
          > >>
          > >> anyway ... perhaps one of the good old 2.0 tricks: <a
          > >> href="#target"> top</a><a name="target"></a>
          > >>
          > >>
          > >> Pieter.
          > >>
          > >> "Joe" <jbloggs2002@ho tmail.com> wrote in message
          > >> news:6448d58f.0 402090616.471a0 70c@posting.goo gle.com...
          > >> > I have a very simple need - I need javascript code to reset a DIV that
          > >> > the user may have scrolled down. It doesn't need to smoothly scroll or
          > >> > anything - just jump right to the top.
          > >> >
          > >> > All help gratefully received.
          > >> > Joe[/color][/color]
          >
          >
          > Not sure if it is this what you're after:
          >
          >
          > ---------8<--------8<--------8<--------
          >
          >
          > <script language='javas cript'>
          >
          > function move_up() {
          > scroll_clipper. scrollTop = 0;
          > }
          >
          > </script>
          >
          > <a href='javascrip t:move_up()'>Mo ve UP</a>
          >
          > <p>
          >
          > <div id='scroll_clip per'
          > style='position :absolute; width:150px; height: 150px; overflow:auto'>
          > <div id='scroll_text ' style='backgrou nd-color:yellow'>
          > Here is some content that can be scrolled.
          > <p>It uses two divs:<ul>
          > <li>scroll_clip per, and
          > <li>scroll_te xt
          > </ul>
          >
          > scroll_clipper defines the scroll area while scroll_text
          > defines the text to be scrolled.
          >
          > </div>
          > </div>
          >
          > ---------8<--------8<--------8<--------
          >
          > hth
          > Rene[/color]

          Comment

          Working...