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. jquery accordition page jumps after completion of accordition

jquery accordition page jumps after completion of accordition

Scheduled Pinned Locked Moved JavaScript
javascriptcsshelptutorialquestion
4 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.
  • P Offline
    P Offline
    pandu web dev
    wrote on last edited by
    #1

    hi, i have a jquery horizontal accordition menu with code something like this // Hide the old content old.slideToggle(500); // Show the new content cur.stop().slideToggle(500); But when the slideToggle function executes and shows new content, the page jumps to top. how to solve this problem? when i have searched in google i have found that it is problem with css height:auto etc, but i have not found a solution. thanks

    A D 2 Replies Last reply
    0
    • P pandu web dev

      hi, i have a jquery horizontal accordition menu with code something like this // Hide the old content old.slideToggle(500); // Show the new content cur.stop().slideToggle(500); But when the slideToggle function executes and shows new content, the page jumps to top. how to solve this problem? when i have searched in google i have found that it is problem with css height:auto etc, but i have not found a solution. thanks

      A Offline
      A Offline
      Ashutosh Mahto
      wrote on last edited by
      #2

      I guess you would have used anchors <a href="#">Link</a> in accordions to open the panel. This is making your page to jump to top. The solution can be in different ways. You can write like <a href="javascript:void(0)">Link</a> Or, you can remove the href and keep the <a> only, but in this case you need to set different styles which are default to anchor tags explicitely. Or, you can use event.preventDefault() inside the handler for that link. I hope I am making a right guess. Thanks

      P 1 Reply Last reply
      0
      • A Ashutosh Mahto

        I guess you would have used anchors <a href="#">Link</a> in accordions to open the panel. This is making your page to jump to top. The solution can be in different ways. You can write like <a href="javascript:void(0)">Link</a> Or, you can remove the href and keep the <a> only, but in this case you need to set different styles which are default to anchor tags explicitely. Or, you can use event.preventDefault() inside the handler for that link. I hope I am making a right guess. Thanks

        P Offline
        P Offline
        pandu web dev
        wrote on last edited by
        #3

        correct solution to this problem thanks

        1 Reply Last reply
        0
        • P pandu web dev

          hi, i have a jquery horizontal accordition menu with code something like this // Hide the old content old.slideToggle(500); // Show the new content cur.stop().slideToggle(500); But when the slideToggle function executes and shows new content, the page jumps to top. how to solve this problem? when i have searched in google i have found that it is problem with css height:auto etc, but i have not found a solution. thanks

          D Offline
          D Offline
          Dholakiya Ankit
          wrote on last edited by
          #4

          add

          return false;

          at last of your javascript function you don't provide much more detail but this could solve your problem also add id of element instead

          cur.stop().slideToggle(500);

          use

          cur.stop().slideToggle("id");

          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