vdw / Tabslet

Yet another jQuery plugin for tabs, lightweight, easy to use, mobile-friendly and with some extra features.
http://vdw.github.io/Tabslet/
Apache License 2.0
565 stars 110 forks source link

How can I tell which Tab was clicked? #34

Closed dhardy123 closed 8 years ago

dhardy123 commented 8 years ago

Is there a way in javascript/jquery to tell which tab was clicked?

vdw commented 8 years ago

Hi, you can use either _before or _after events to get the element was clicked.

$('.tabs').on("_after", function(e) {
  alert(e.target);
});

where e.target returns <li class="active">...</li>

Here is an example: http://jsfiddle.net/dkrestos/Lczqrjte/