JSFiddle - React, Tailwind, and code Playground
HTML
<div class="containertab" >
<ul class="tabs">
<li><a href="#tab1"></a></li>
<li><a href="#tab2"></a></li>
<li><a href="#tab3"></a></li>
<li><a href="#tab4"></a></li>
<li><a href="#tab5"></a></li>
</ul>
<div class="tab_container">
<div id="tab1" class="tab_content">
<b>Titulo 1</b><p></p>
<p>Corpo da Noticia 1. </p><div class="SaberMais"><a href="www.google.pt" target="_blank">Saber mais</a></div>
</div>
<div id="tab2" class="tab_content">
<b>Titulo 2</b><p></p>
<p>Corpo da Noticia 2. </p>
</div>
<div id="tab3" class="tab_content">
<b>Titulo 3</b><p></p>
<p>Corpo da Noticia 3. </p>
</div>
<div id="tab4" class="tab_content">
<b>Titulo 4 <img src="Noticias/Imagens/Exemplo.jpg" width="60" height="45"> </b><p></p>
<p> Corpo da Noticia 4</p>
</div>
<div id="tab5" class="tab_content">
<b>Titulo 5 <img src="Noticias/Imagens/Exemplo1.png" width="85" height="50"></b><p></p>
<p> Corpo da Noticia 5</p>
</div>
</div>
</div>
CSS
.containertab {
position: absolute;
left: 1%;
top: 34%;
width: 60%;
margin: 2% auto; }
ul.tabs {
margin: 0;
padding: 0;
float: left;
height: 32px;
border-bottom: 1px solid #999;
border-left: 1px solid #999;
width: 100%;
}
ul.tabs li {
float: left;
margin: 0;
padding: 0;
height: 31px;
line-height: 31px;
border: 0px solid #999;
border-left: none;
margin-bottom: -1px;
background: #F0F0F0;
overflow: hidden;
position: relative;
}
ul.tabs li a {
text-decoration: none;
color: #000;
display: block;
font-size: 1.0em;
padding: 0 20px;
border: 1px solid #999999;
outline: none;
}
ul.tabs li a:hover {
background: #ccc;
}
ul.tabs li a:after {
content: '\25CF';
}
html ul.tabs li.active, html ul.tabs li.active a:hover {
background: #fff;
border-bottom: 1px solid #fff;
}
.tab_container {
border: 1px solid #999;
border-top: none;
clear: both;
float: left;
width: 100%;
background: #F0F0F0;
-moz-border-radius-bottomright: 5px;
-khtml-border-radius-bottomright: 5px;
-webkit-border-bottom-right-radius: 5px;
-moz-border-radius-bottomleft: 5px;
-khtml-border-radius-bottomleft: 5px;
-webkit-border-bottom-left-radius: 5px;
}
.tab_content {
padding: 20px;
font-size: 0.9em;
}
.tab_content h2 {
font-weight: normal;
padding-bottom: 10px;
border-bottom: 1px dashed #ddd;
font-size: 1.8em;
}
.tab_content h3 a{
color: #254588;
}
.tab_content img {
float: right;
margin: 0 20px 20px 0;
border: 1px solid #ddd;
padding: 5px;
}
.SaberMais {
float: Right;
border: 1px solid #ddd;
padding: 2px;
font-size: 0.8em;
}
.nounderline:link
{
text-decoration:none;
}
JavaScript
$(document).ready(function() {
//Default Action
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active content
return false;
});
$("ul.tabs li a").each(function() {
$(this).html("");
});
var totalTabs = $("ul.tabs li").length;
window.setInterval(function() {
var index = $('.tabs > .active').next('li').index() +1;
//$('.tabs > .active').next('li').find('a').trigger('click');
if (index > totalTabs || index == 0) {
$('')
$("a[href=#tab1]").trigger('click');
} else {
$("a[href=#tab"+index+"]").trigger("click");
}
}, 4000);
});