LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code



	Shuffle and Sort
	
	
	

	
	



 

Shuffel and Sort

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
CSS
.wrapper {
    width: 960px;
    margin: 0 auto;
    background: #efefef;
}
header {
    -moz-box-shadow-bottom: 0px #000;
    -webkit-box-shadow-bottom: 0px #000;
    box-shadow-bottom: 0px #000;
    border: 1px solid #fff;
    margin: 0;
    padding: 0em;
    border-bottom: 0;
}
.line {
    background: #333;
    height: 7px;
    opacity: 0.44;
    margin-bottom: -7px;
}
h1 {
    text-align: center;
    font-weight: 100;
    color: #333;
}
aside {
    float: right;
}
section {
    overflow: hidden;
    min-height: 170px;
}
ul {
    margin: 0;
    padding: 0;
}
ul li {
    list-style: none;
    padding: 0.4em 0.9em;
    margin: 0px -3px;
    font-size: 6em;
    display: inline-block;
    color: #fff;
    font-weight: 100;
}
.li-3,
.li-5,
.li-9 {
    background: #2f454e;
}
.li-2,
.li-4 {
    background: #2b8ead;
}
.li-1,
.li-8 {
    background: #6f98a8;
}
.li-6,
.li-7 {
    background: #bfbfbf;
}
/*==========  Button  ==========*/

.btn {
    overflow: visible;
    display: block;
    width: 240px;
    position: relative;
    top: 0px;
    font-family: inherit;
    text-decoration: none;
    font-size: 16px;
    text-transform: uppercase;
    background: #f7f7f7;
    padding: 15px 50px;
    margin: 25px 22px 0 10px;
    border: 1px solid #c4c4c4;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 5px;
    -webkit-box-shadow: 0px 5px 0px #c4c4c4;
    -moz-box-shadow: 0px 5px 0px #c4c4c4;
    -ms-box-shadow: 0px 5px 0px #c4c4c4;
    -o-box-shadow: 0px 5px 0px #c4c4c4;
    box-shadow: 0px 5px 0px #c4c4c4;
    color: #222;
    text-shadow: 1px 1px 1px #fff;
    -webkit-transition: All 250ms ease;
    -moz-transition: All 250ms ease;
    -o-transition: All 250ms ease;
    -ms-transition: All 250ms ease;
    transition: All 250ms ease;
    padding: 0.8em 2em;
}
/*==========  Button Active State  ==========*/

.btn:active {
    position: relative;
    top: 5px;
    -webkit-box-shadow: none !important;
    -moz-box-shadow: none !important;
    -ms-box-shadow: none !important;
    -o-box-shadow: none !important;
    box-shadow: none !important;
    -webkit-transition: All 250ms ease;
    -moz-transition: All 250ms ease;
    -o-transition: All 250ms ease;
    -ms-transition: All 250ms ease;
    transition: All 250ms ease;
}
/*==========  Button Blue  ==========*/

.btn.blue {
    background: #72c3dc;
    color: #fff;
    border: 1px solid #2b8ead;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 5px;
    -webkit-box-shadow: 0px 5px 0px #2b8ead;
    -moz-box-shadow: 0px 5px 0px #2b8ead;
    -ms-box-shadow: 0px 5px 0px #2b8ead;
    -o-box-shadow: 0px 5px 0px #2b8ead;
    box-shadow: 0px 5px 0px #2b8ead;
    text-shadow: 1px 1px 1px #2b8ead;
    font-weight: 100;
}
footer {
    font-size: 0.8em;
    text-align: center;
    color: #333;
    padding: 5px;
}
@media screen and (min-width: 360px) and (max-width: 1000px) {
    .wrapper {
        background: none;
        width: 100%;
    }
    .line {
        display: none;
    }
    aside {
        float: none;
        margin: 1em;
        width: auto;
        border: 0;
        text-align: center;
    }
    header {
        background: #333;
        color: #fff;
    }
    h1 {
        color: #fff;
        height: 60px;
    }
    .btn {
        overflow: visible;
        padding: 15px 25px;
        display: inline-block;
        margin: 10px;
        width: 135px;
    }
    ul li {
        list-style: none;
        padding: 0.3em;
        display: block;
        margin: 0;
        color: #333;
        font-size: 3em;
        text-align: center;
    }
    .li-1,
    .li-2,
    .li-3,
    .li-4,
    .li-5,
    .li-6,
    .li-7,
    .li-8,
    .li-9 {
        background: #efefef;
        margin-bottom: 10px;
    }
    .li-3,
    .li-5,
    .li-9 {
        border-left: 0.3em solid #2f454e;
    }
    .li-2,
    .li-4 {
        border-left: 0.3em solid #2b8ead;
    }
    .li-1,
    .li-8 {
        border-left: 0.3em solid #6f98a8;
    }
    .li-6,
    .li-7 {
        border-left: 0.3em solid #bfbfbf;
    }
}
JS
window.onload=function(){
var list = document.getElementById("shuffleAndSort"),
button = document.getElementById("shuffle");
function shuffle(items)
{
    var cached = items.slice(0), temp, i = cached.length, rand;
    while(--i)
    {
        rand = Math.floor(i * Math.random());
        temp = cached[rand];
        cached[rand] = cached[i];
        cached[i] = temp;
    }
    return cached;
}
function shuffleNodes()
{
    var nodes = list.children, i = 0;
    nodes = Array.prototype.slice.call(nodes);
    nodes = shuffle(nodes);
    while(i < nodes.length)
    {
        list.appendChild(nodes[i]);
        ++i;
    }
} 
document.getElementById("shuffle").onclick = shuffleNodes;

}

Description

JavaScript - Shuffle and Sort develop by http://pankajsuralkar.in
Term
Sat, 04/14/2018 - 20:42

Related Codes

Pen ID
Pen ID
Pen ID
Square Adv