JSFiddle - React, Tailwind, and code Playground
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>codenameT</title>
<script src="slidebox.js"></script>
</head>
<body>
<div id="container">
<div id="header">
<ul class="menu">
<li><a title="About" href="about.php">About</a></li>
<li><a title="Mission" href="mission.php">Mission</a></li>
<li><a title="Appear" href="appear.php">Appear</a></li>
<li><a title="Home" href="index.php">Home</a></li>
</ul>
</div>
<div id="wrapper">
<div id="content">
<p><strong>1) PRINCIPALE</strong> column long long column very long fill fill fill long text text column text silly very make long very fill silly make make long make text fill very long text column silly silly very column long very column filler fill long make filler long silly very long silly silly silly long filler make column filler make silly long long fill very.</p>
<p>very make make fill silly long long filler column long make silly silly column filler fill fill very filler text fill filler column make fill make text very make make very fill fill long make very filler column very long very filler silly very make filler silly make make column column </p>
<p>fill long make long text very make long fill column make text very silly column filler silly text fill text filler filler filler make make make make text filler fill column filler make silly make text text fill make very filler column very </p>
<p>column text long column make silly long text filler silly very very very long filler fill very fill silly very make make filler text filler text make silly text text long fill fill make text fill long text very silly long long filler filler fill silly long make column make silly long column long make very </p>
</div>
</div>
<div id="left">
<div id="light-slide">
<ul>
<li>testo html 1</li>
<li>testo html 2</li>
<li>testo html 3</li>
<li>testo html 4</li>
</ul>
</div>
</div>
<div id="right">
</div>
</div>
</body>
</html>
CSS
html,body{margin:0;padding:0}
/*body{font: 76% arial,sans-serif;text-align:center}*/
body{
font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "Arial";
text-align:center;
}
p{margin:0 10px 10px}
a{
/*display:none;*/
color: #B9CAFF;
/*padding:10px*/
text-decoration: none;
}
a:visited{
color: #B9CAFF;<br />
-webkit-transition:color 500ms ease-in;
-moz-transition:color 500ms ease-in;
-o-transition:color 500ms ease-in;
transition:color 500ms ease-in;
}
a:hover {
/*background-color:#B9CAFF;*/
color:#000;
-webkit-transition:color 500ms ease-in;
-moz-transition:color 500ms ease-in;
-o-transition:color 500ms ease-in;
transition:color 500ms ease-in;
}
#light-slide {width: 400px; height: 200px; overflow: hidden; position: relative;}
#light-slide ul {height: 200px; position: absolute; top: 0; left: 0;}
/* We set the width and the height of each list item to match the slider container */
#light-slide li {width: 400px; height: 200px; float: left;}
/* The following code just sets the control button styling */
#control a {background:#999;padding:6px;display:block;float:left;margin-right:5px;}
#control a.active{background:#111;padding:6px;display:block;float:left;outline:none;}
div#header {
height:70px;line-height:40px;margin:0;
padding-left:10px;background: #ffffff;color: #000000;
border-style:none;
border-color:#EEE;
}
div#container{
text-align:left;
}
div#content {
line-height:1.4;
text-align:left;
}
div#left{
background:#B9CAFF
}
div#left a{
color:#5983A0;
}
div#left a:visited{
color: #5983A0;<br />
-webkit-transition:color 500ms ease-in;
-moz-transition:color 500ms ease-in;
-o-transition:color 500ms ease-in;
transition:color 500ms ease-in;
}
div#left a:hover {
/*background-color:#B9CAFF;*/
color:#000000;
-webkit-transition:color 500ms ease-in;
-moz-transition:color 500ms ease-in;
...
JavaScript
$(document).ready(function (){
// Here we check how many list items are present and generate the correspdonding number of control buttons //
var controlHtml = '<div id="control">';
$('#light-slide li').each(function(){
controlHtml += '<a href="#"></a>';
});
controlHtml += '</div>';
$('#light-slide').after(controlHtml);
// Set the first button to "active" //
$('#control a:first').addClass('active');
// Next we define the click event and subsequent animate function that will move our slider to the correct position //
var $slideButton = $('#control a');
$slideButton.click(function(e){
$slideButton.removeClass('active');
$(this).addClass('active');
var integer = $(this).index();
$('#light-slide ul').animate({"left": -400*integer}, 400);
e.preventDefault();
});
});
setInterval(function(){
// Enter animation functions
var $slideNow = $('#control .active');
$slideNow.removeClass('active');
if($slideNow.is(':last-child')){
var $slideNew = $('#control a:first');
} else {
var $slideNew = $slideNow.next();
}
$slideNew.addClass('active');
var integer = $slideNew.index();
$('#light-slide ul').animate({"left": -400*integer}, 400);
}, 3000);