javascript - onclick event for jquery tabs - Stack Overflow

I have tabs inside tabs. What I wan to do is set a variable to something once a tab is clicked. so if t

I have tabs inside tabs. What I wan to do is set a variable to something once a tab is clicked. so if the brush tab is clicked then that var is set to true, if the pencil tab is selected the others are set to false and this is set to true.

Now I assume you must have an on click event attached to the tabs and when clicked it will call a function. My problem is how to put a on click event for each tab? Her is a live example of what I have done: .html

here is my html code for the tabs:

<div id="tabs" style=" position:absolute; right:20; top: 30; z-index: 1; ">
  <ul>
    <li><a href="#tabs-1">Paint</a></li>
    <li><a href="#tabs-2">Shapes</a></li>
    <li><a href="#tabs-3">Save/Submit</a></li>
    <li><a href="#tabs-4">About</a></li>
  </ul>
  <div id="tabs-1">
  <div id="accordion">

    <h3>Brush</h3>
    <div>
    <center>
      <p>Brush Size</p>
    <div id="sliderBrush"></div>
    <div id="Total">10</div>

<p id="colorpickerHolder" >
                </p>

    </center>
    </div>

    <h3>Pencil</h3>
      <div>
    <center>
      <p>Pencil Size</p>
    <div id="sliderPencil"></div>
    <div id="TotalPencil">10</div>

<p id="colorpickerHolderPencil" >
                </p>

    </center>
    </div>

    <h3>Eraser</h3>
    <div>
     Coming soon!
    </div>

  </div>
</div>

I have tabs inside tabs. What I wan to do is set a variable to something once a tab is clicked. so if the brush tab is clicked then that var is set to true, if the pencil tab is selected the others are set to false and this is set to true.

Now I assume you must have an on click event attached to the tabs and when clicked it will call a function. My problem is how to put a on click event for each tab? Her is a live example of what I have done: http://www.taffatech./Paint.html

here is my html code for the tabs:

<div id="tabs" style=" position:absolute; right:20; top: 30; z-index: 1; ">
  <ul>
    <li><a href="#tabs-1">Paint</a></li>
    <li><a href="#tabs-2">Shapes</a></li>
    <li><a href="#tabs-3">Save/Submit</a></li>
    <li><a href="#tabs-4">About</a></li>
  </ul>
  <div id="tabs-1">
  <div id="accordion">

    <h3>Brush</h3>
    <div>
    <center>
      <p>Brush Size</p>
    <div id="sliderBrush"></div>
    <div id="Total">10</div>

<p id="colorpickerHolder" >
                </p>

    </center>
    </div>

    <h3>Pencil</h3>
      <div>
    <center>
      <p>Pencil Size</p>
    <div id="sliderPencil"></div>
    <div id="TotalPencil">10</div>

<p id="colorpickerHolderPencil" >
                </p>

    </center>
    </div>

    <h3>Eraser</h3>
    <div>
     Coming soon!
    </div>

  </div>
</div>
Share Improve this question asked Jun 17, 2013 at 9:15 Steven BarrettSteven Barrett 3312 gold badges6 silver badges14 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

See API

beforeActivate( event, ui ) 

Triggered immediately before a tab is activated.

    $( "#tabs-1" ).on( "tabsbeforeload", function( event, ui ) {
            //control es here when you clicked on tab 1
    } )

http://api.jqueryui./tabs/#event-beforeLoad

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744030100a4546394.html

相关推荐

  • javascript - onclick event for jquery tabs - Stack Overflow

    I have tabs inside tabs. What I wan to do is set a variable to something once a tab is clicked. so if t

    9天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信