Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Stop a page moving upwards

Stop a page moving upwards

Scheduled Pinned Locked Moved JavaScript
javascripttutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    offroaderdan
    wrote on last edited by
    #1

    Hi guys, I have a small question, I am creating a website and have created a table using ul elements. (I used ul as this was easier to animate using javascript and it does what i want.... I did try using tables and it messed up. When I click on one of the ul items the page stays where it is. However when i click another one the page then shoots to the top. I have read around and some people say do the following

    blah

    However this still sends the page to the top. If any body knows any tips/tricks as to how to solve this it would be mighty helpful.

    J L 2 Replies Last reply
    0
    • O offroaderdan

      Hi guys, I have a small question, I am creating a website and have created a table using ul elements. (I used ul as this was easier to animate using javascript and it does what i want.... I did try using tables and it messed up. When I click on one of the ul items the page stays where it is. However when i click another one the page then shoots to the top. I have read around and some people say do the following

      blah

      However this still sends the page to the top. If any body knows any tips/tricks as to how to solve this it would be mighty helpful.

      J Offline
      J Offline
      jkirkerx
      wrote on last edited by
      #2

      You must of fired a postback to the same page, and the page scroll position reset back to the top. Hyperlinks are designed to navigate to a new page, unless your using the hyperlink to scroll the page to a designated position.

      1 Reply Last reply
      0
      • O offroaderdan

        Hi guys, I have a small question, I am creating a website and have created a table using ul elements. (I used ul as this was easier to animate using javascript and it does what i want.... I did try using tables and it messed up. When I click on one of the ul items the page stays where it is. However when i click another one the page then shoots to the top. I have read around and some people say do the following

        blah

        However this still sends the page to the top. If any body knows any tips/tricks as to how to solve this it would be mighty helpful.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        When you supply an href you're telling the browser to navigate. The only exception is if you have a special href value prefix like mailto: or javascript: If you change your link to:

        [blah](javascript:SomeMethod();)

        or

        blah

        it should not navigate to the top. Ideally you should omit the href attribute altogether, and use the 'click' event, either as the onclick attribute, or as an event binding in javascript code.

        “I have no special talents. I am only passionately curious.” - Albert Einstein

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups