Well, I have a box, this box has some tabs, clicking on the tab the contents of the box changes. The content is changed when I click on one of the links that the tab calls. Here is the code:
<p id="slid">
<a href="#slid3">3º Passo</a>
<a href="#slid2" >2º Passo</a>
<a href="#slid1" class="slidselected" >1º Passo</a>
</p>
<ul id="slidcontents">
<!-- tab 1 -->
<li id="slid1">
Conteúdo que aparece ao clicar no link 1º passo
</li>
<li id="slid2">
Conteúdo que aparece ao clicar no link 2º passo
</li>
<li id="slid3">
Conteúdo que aparece ao clicar no link 3º passo
</li>
</ul>
So the content of the box changes only when you click on some of the links that are inside the p id="slid", and I would like to automate this, making even if I do not click any of these links contents of the box to change as if it had been clicked. The script I use to change the contents of the box is:
$.quickslidl = function ()
{
/* Elements */
var slidl = 'p#slid';
var cont_slid = 'ul#slidcontents';
/* Hide all post */
$(cont_slid + ' li').hide();
/* Display the first tab */
$(cont_slid + ' li:first-child').show();
/* When user click a tab */
$(slidl + ' a').click(function()
{
/* Remove slidselected class on all post */
$(slidl + ' a').removeClass('slidselected');
/* Add a slidselected tab class */
$(this).addClass('slidselected');
/* Hide all opened tags */
$(cont_slid + ' li').hide();
/* Display the clickec tab */
$(cont_slid + ' ' + $(this).attr('href')).show();
/* End :D */
return false;
});
};
/* When all is ready */
$(document).ready(function() {
/* Start function */
$.quickslidl();
});