admin管理员组文章数量:1356340
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
1 Answer
Reset to default 4See 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
本文标签: javascriptonclick event for jquery tabsStack Overflow
版权声明:本文标题:javascript - onclick event for jquery tabs - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744030099a2578745.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论