JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<div class='menu_grid'>
<ul id='sortable'>
<li class='ui-state-default'>
<div id='gallery'>
<a class='show' href='#'>
<img alt='Flowing Rock' height='96' rel='' src='https://lh5.googleusercontent.com/-1TaqXNcFvgE/UJnweKs6cOI/AAAAAAAAAc4/CMc59rp727w/s197/windows8.gif' title='' width='197'/>
</a><a href='#'>
<img alt='Grass Blades' height='96' rel='' src='https://lh5.googleusercontent.com/-gU0FTWlcUBQ/UJnwbOPMXpI/AAAAAAAAAcM/y6Cx0UdPECw/s197/android.gif' title='' width='197'/>
</a><a href='#'>
<img alt='Ladybug' height='96' rel='' src='https://lh3.googleusercontent.com/-wQ4f4HfhbBw/UJnyBYSXhxI/AAAAAAAAAdo/a1NP7xthBmM/s197/NokiaS40.gif' title='' width='197'/>
</a>
</div>
</li>
<li class='ui-state-default'/>
<li class='ui-state-default'><a href='http://www.Erhay.com/'><img src='https://lh4.googleusercontent.com/-QHqJ2PuyHoQ/UJnwbGsR58I/AAAAAAAAAcE/5tu0JBwPT5w/s96/blogger.gif'/></a></li>
<li class='ui-state-default'><a href='http://www.Erhay.com/'><img src='https://lh6.googleusercontent.com/-24OwE4ZwAFc/UJnwc0YywLI/AAAAAAAAAck/xqy_iZTgmNo/s96/hotienganh.gif'/></a></li>
<li class='ui-state-default'><a href='http://www.Erhay.com/'><img src='https://lh4.googleusercontent.com/-cn0fm-iuhKw/UJnwdwsKVxI/AAAAAAAAAcw/7x9F5aMwR3M/s96/truyenhay.gif'/></a></li>
<li class='ui-state-default'><a href='http://www.Erhay.com/'><img src='https://lh6.googleusercontent.com/-rqtwhmocTt4/UJnwdPDrOcI/AAAAAAAAAco/wRU_Pw7iAMg/s96/laptrinh.gif'/></a></li>
<li class='ui-state-default'><a href='http://www.Erhay.com/'><img...
CSS
body{background:#551893}
<!-- Phần menu Grid -->
<!-- Menu Metro slide -->
.clear {
clear:both
}
#gallery {
position:relative;
height:96px;
float:left;
z-index: 0;
}
#gallery a {
float:left;
position:absolute;
}
#gallery a img {
border:none;
z-index: 0;
}
#gallery a.show {
z-index:500;
}
.menu_grid
{
margin:0 auto;
text-align: center;
color: White;
margin: 0 auto;
width: 320px;
height:250px;
background:url();
padding-top:15px;
padding-left:10px;
}
.menu_grid ul
{ text-align:center;
list-style: none;
}
.menu_grid ul li a:hover
{
background:#8ed3e7;
width:98px;
height:94px;
cursor:default;
padding:0px 0px 1px 0px;
}
#sortable
{
list-style-type: none;
margin: 0;
padding: 0;
width: 320px;
}
#sortable li
{
margin: 2px 4px 3px 2px;
float: left;
width: 95px;
height: 97px;
text-align: center;
line-height:96px;
}
#sortable li span { position: absolute; margin-left: -1.3em; }
JavaScript
$(document).ready(function() {
//Execute the slideShow
slideShow();
});
function slideShow() {
//Set the opacity of all images to 0
$('#gallery a').css({opacity: 0.0});
//Get the first image and display it (set it to full opacity)
$('#gallery a:first').css({opacity: 1.0});
//Set the caption background to semi-transparent
$('#gallery .caption').css({opacity: 0.7});
//Resize the width of the caption according to the image width
$('#gallery .caption').css({width: $('#gallery a').find('img').css('width')});
//Get the caption of the first image from REL attribute and display it
$('#gallery .content').html($('#gallery a:first').find('img').attr('rel'))
.animate({opacity: 0.7}, 400);
//Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
setInterval('gallery()',6000);
}
function gallery() {
//if no IMGs have the show class, grab the first image
var current = ($('#gallery a.show')? $('#gallery a.show') : $('#gallery a:first'));
//Get next image, if it reached the end of the slideshow, rotate it back to the first image
var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#gallery a:first') :current.next()) : $('#gallery a:first'));
//Get next image caption
var caption = next.find('img').attr('rel');
//Set the fade in effect for the next image, show class has higher z-index
next.css({opacity: 0.0})
.addClass('show')
.animate({opacity: 1.0}, 1000);
//Hide the current image
current.animate({opacity: 0.0}, 1000)
.removeClass('show');
//Set the opacity to 0 and height to 1px
$('#gallery .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });
//Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
$('#gallery...