JSFiddle - React, Tailwind, and code Playground
HTML
<div class="wrapper">
<div class="control-container cm-cf">
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
<div class="control-play cm-left">
<span id="action-btn" class="play-btn"></span>
</div>
<div class="control-waveform cm-right">
</div>
</div>
<div class="image-container">
<div id="control-btn">Pause</div>
<img src="http://farm3.static.flickr.com/2666/3686946460_0acfa289fa_m.jpg" style="position:absolute; top:-250px; width:250px; height:250px;"></img>
<img src="http://farm4.static.flickr.com/3611/3686140905_cbf9824a49_m.jpg" style="position:absolute; top:-250px; width:250px; height:250px;"></img>
<img src="http://farm4.static.flickr.com/3274/3686140135_1b83dba0c3_m.jpg" style="position:absolute; top:-250px; width:250px; height:250px;"></img>
<img src="http://farm4.static.flickr.com/3051/2692672949_275253ed55_m.jpg" style="position:absolute; top:-250px; width:250px; height:250px;"></img>
<img src="http://farm4.static.flickr.com/3029/2693485702_758c53f7f1_m.jpg" style="position:absolute; top:-250px; width:250px; height:250px;"></img>
<img src="http://farm4.static.flickr.com/3221/2693483418_1af5714ea0_m.jpg" style="position:absolute; top:-250px; width:250px; height:250px;"></img>
<img src="http://farm4.static.flickr.com/3162/2693480990_15c6619af2_m.jpg" style="position:absolute; top:-250px; width:250px; height:250px;"></img>
<img src="http://farm4.static.flickr.com/3022/2615341879_7fe63af14b_m.jpg" style="position:absolute; top:-250px; width:250px; height:250px;"></img>
<img src="http://farm4.static.flickr.com/3141/2615340453_d9f158bb14_m.jpg" style="position:absolute; top:-250px; width:250px; height:250px;"></img>
<img src="http://farm4.static.flickr.com/3232/2615338551_0685099d6d_m.jpg" style="position:absolute; top:-250px; width:250px; height:250px;"></img>
<img src="http://farm4.static.flickr.com/3124/2615336735_95b85e7999_m.jpg" style="position:absolute; top:-250px;...
CSS
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video, input {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
* {
outline: none;
}
.cm-center-text{
text-align: center;
}
.cm-left{float: left;}
.cm-right{float: right;}
.cm-cf:before,.cm-cf:after {content: " ";display: table;}
.cm-cf:after {clear: both;}
a{
text-decoration:none;
}
/**
* For IE 6/7 only
* Include this rule to trigger hasLayout and contain floats.
*/
.cm-cf {
*zoom: 1;
}
*{
margin: 0;
padding: 0;
border: 0;
}
ul,ol {
list-style: none;
}
body {
overflow: hidden;
}
html,body{
min-height: 100%;
height: 100%;
}
.wrapper{
position: relative;
width: 100%;
height: 100%
}
.control-container{
height: 122px;
width: 100%;
border-bottom: 1px solid #b6b6b6;
}
.play-btn{
border-radius: 50%;
width: 200px;
height: 200px;
background: #29bb9b;
width: 150px;
height: 150px;
padding: 25px;
cursor: pointer;
}
.control-play{
padding: 48px;
width: 59px;
}
.control-waveform{
width: 1190px;
overflow: hidden;
}
.image-container{
background: #eaeaea;
min-height: 100%;
position: relative;
overflow: hidden;
}
#control-btn{
cursor:pointer;
}
}
JavaScript
$(document).ready(function(){
$.fn.pSlide = function(options) {
var icount = 0,interval;
var isPaused = false;
documentHeight = $('.image-container').height(),
documentWidth = $('.image-container').width(),
imageHeight = 250;
imageWidth = 250;
defaults = {
minSize : 5,
maxSize : 15,
newOn : 8000, //controls duration of each element
},
options = $.extend({}, defaults, options);
$('#control-btn').click(function() {
window.clearInterval(interval);
});
interval = window.setInterval(function() {
if(!isPaused) {
var $elm = $('.image-container img').eq(icount);
var startPositionLeft = Math.random() * documentWidth - imageWidth ,
startOpacity = 0.5 + Math.random(),
endPositionTop = documentHeight - 40,
endPositionLeft = startPositionLeft - 100 + Math.random() * 200,
durationFall = documentHeight * 10 + (Math.random() * 15000)+5000, //controls the speed of transition
rotateValue = Math.random();
if(startPositionLeft<imageWidth) {
startPositionLeft = imageWidth;
}
if(rotateValue<=0.5) {
rotateValue = 0;
}else{
rotateValue *= 10;
rotateValue *= Math.cos(Math.PI * Math.round(Math.random())); //cos(0) = 1; cos(PI) = -1
}
if(icount==20)
icount=0;
else
icount++;
$elm
// .clone()
// .appendTo($('.image-container'))
.css(
{
left: startPositionLeft,
opacity: startOpacity,
'-webkit-transform': 'rotate(' + rotateValue +'deg)',
'-moz-transform': 'rotate(' + rotateValue +'deg)',
'-o-transform': 'rotate(' + rotateValue +'deg)',
'-ms-transform': 'rotate(' + rotateValue +'deg)',
'zoom' : 1
}
)
.animate(
{
top: endPositionTop,
left: endPositionLeft,
opacity: 0.2
},
durationFall,
'linear',
function() {
$(this).css({'top':'-250'+'px' ,...