#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    59
    Rep Power
    2

    Java Script Drop Tab


    Can anyone help me make a Java Script Drop Tab. I can make a drop tab in html but I want to learn how to make it in Java because it would save me a lot of time in the long run.

    Brian
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Location
    The Pleiades
    Posts
    299
    Rep Power
    9
    Good afternoon,

    Use a button or a div as the 'tab'.

    Position another div right underneath the tab to hold the content - setting margins/padding as preferred.

    Set the content div to display: none; by default.

    Now,

    Write some jQuery to handle the click event, so once the tab has been clicked; slide it down, fade it in etc.

    You'd be better off making use of the Toggle functions in jQuery in case you'd like to hide the dropdown after it's been displayed.

    Kind regards,

    NM.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    59
    Rep Power
    2
    $(".tab").bind("click", handle_tab_click);

    unction (event) {
    if ($(event.target).hasClass("my_tab")) { /* handle tab click */ }
    if ($(event.target).hasClass("my_tab_2")) { /* a different name tab click */ }
    if ($(event.target).hasClass("my_tab_3")) { /* ... */ }
    }


    I would like to open the same page with less information. I handle the click event in like this. Can I use some java so I do not need all the web sites. The way I am going about this is to have a site for each Name and then link to them. Could I do this a easier way with Java Script?

IMN logo majestic logo threadwatch logo seochat tools logo