Hi Lukas

If you have 10 tabs, for example:

<div class="tab">tab1</div>
<div class="tab">tab2</div>
<div class="tab">tab3</div>
...
<div class="tab">tab10</div>

Just add a class,'tab', inside each tab, and then you can use
$(".tab").click(function()) to bind the click function on each tab.

HTP
Becoder.

On Fri, Oct 16, 2009 at 10:53 PM, lukas <animod...@gmail.com> wrote:

>
> Thank you for your quick response! In the meantime I tried something
> similar, I thought there is a solution which doesn't require that much
> code. (Imagine you have 10 tabs!)
>
> On Oct 16, 3:57 am, Bi Jing <beco...@gmail.com> wrote:
> > Firstly, define a new css class , selected_tab , as following:
> >
> > //Style code
> > .selected_tab{
> > background-color:#ccc;
> > color:#000;
> >
> > }
> >
> > //Script code
> > //$(".tab") indicate all of your tab elements.
> > $(".tab").click(function(){
> >     $(".selected_tab").removeClass("selected_tab"); // clear current
> select
> > tab style
> >     $(this).addClass("selected_tab");}
> >
> > )
> >
> > Hope that helps.
> >
> > Becoder.
> >
> > On Fri, Oct 16, 2009 at 11:57 AM, lukas <animod...@gmail.com> wrote:
> >
> > > Can anybody direct me to a lightweight jquery script controlling tabs?
> > > I just want the activated tab to appear differently than the rest of
> > > the tabs. Thank you!
>

Reply via email to