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. General Programming
  3. C#
  4. how to jump to the particular section in a tab from different tab

how to jump to the particular section in a tab from different tab

Scheduled Pinned Locked Moved C#
questionhelptutorial
2 Posts 2 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.
  • D Offline
    D Offline
    Dhyanga
    wrote on last edited by
    #1

    Hello , I have a situation where I need to jump to a specific location from tab 1 to tab 2's certain section. Here is the sample of my code.

    @{

    tab1
    click me 1

    click me 2

    tab2

    test1 description

    • This is a test 1.

    test2 description

    • This is a test 2.

    test3 description

    • This is a test 3.

    test4 description

    • This is a test 4.

    test5 description

    • This is a test 5.

    test6 description

    • This is a test 6.

    test7 description

    • This is a test 7.

    test8 description

    • This is a test 8.

    test9 description

    • This is a test 9.

    test10 description

    • This is a test 10.

    test11 description

    • This is a test 11.

    test12 description

    • This is a test 12.

    test13 description

    • This is a test 13.

    test14 description

    • This is a test 14.

    }

    Now how do i click "Click me 1" and go to the "tabs-2" and scroll down to "test14 description"? Please help. Thank you

    Dhyanga

    Richard DeemingR 1 Reply Last reply
    0
    • D Dhyanga

      Hello , I have a situation where I need to jump to a specific location from tab 1 to tab 2's certain section. Here is the sample of my code.

      @{

      tab1
      click me 1

      click me 2

      tab2

      test1 description

      • This is a test 1.

      test2 description

      • This is a test 2.

      test3 description

      • This is a test 3.

      test4 description

      • This is a test 4.

      test5 description

      • This is a test 5.

      test6 description

      • This is a test 6.

      test7 description

      • This is a test 7.

      test8 description

      • This is a test 8.

      test9 description

      • This is a test 9.

      test10 description

      • This is a test 10.

      test11 description

      • This is a test 11.

      test12 description

      • This is a test 12.

      test13 description

      • This is a test 13.

      test14 description

      • This is a test 14.

      }

      Now how do i click "Click me 1" and go to the "tabs-2" and scroll down to "test14 description"? Please help. Thank you

      Dhyanga

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      You'll need to add an id to any element that you want to be a navigation target.

      <p id="test14">test14 description</p>

      You then specify that ID in the URL:

      <a href="mypage/#test14">click me 1</a>

      How you ensure that tabs-2 will be visible when you navigate to an item within the tab depends the script / CSS you're using to create the tabs. For example, with Bootstrap, something like this should work:

      $(function(){
      $("#tabs").tab();

      if (location.hash){
          var target = $(":target");
          if (!target.is(".tab-pane")){
              target = target.closest(".tab-pane");
          }
          if (target.is(".tab-pane")){
              // When the tab has finished fading in, scroll down to the target element:
              $("#tabs").one("shown.bs.tab", function(){
                  $("html, body").animate({
                      scrollTop: $(":target").offset().top
                  }, "fast");
              });
              
              var id = target.prop("id");
              $("a\[data-toggle='tab'\]\[href='#" + id + "'\]").tab("show");
          }
      }
      

      });

      NB: This question has nothing to do with C#. In future, please post in the correct forum.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      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