Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Get $(this) tab clicked in jQuery UI Tabs widget

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #167387
    Anonymous
    Inactive

    i want to get the li tab clicked of the jQuery tabs Widget. For example if i click on the second tab, i want to get the width and offset of that specific tab clicked. I tried this but nothing :P. And is there a way i could get the active tab, but based on the active slide? for example if the third slide is active, i want to add a class to the 3rd tab but not because it was clicked, but because its specified slide is active.

    $("#area").tabs({
        event: "click",
        hide: "slideUp",
        show: "slideDown",
        active : 0,
    
        $(this).offset().left;
        $(this).width();
    
    });
    
    #167388
    Paulie_D
    Member

    A Codepen.io example would be useful but from a quick glance you aren’t actually selecting am individual entry so $this won’t work.

    Then again, my JS/JQ skills are poor.

    #167427
    Podders
    Participant

    You have to hook into the activate event to achieve what you want, the activate event exposes the ui object which holds information about the selected tab and the previous tab,

    You can also get information about the currently selected tab index requesting the active option

    heres a pen http://codepen.io/Podders/pen/jcdkw/

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.