Desktop to mobile animation - Razorflow
Animation via jquery
HTML
<div class="container">
<div class="green"></div>
<div class="red"></div>
</div>
CSS
.container {
border: 1px solid #999;
position: relative;
height: 300px;
width: 400px;
margin: 0 auto;
}
.red {
height: 200px;
width: 100px;
background-color: red;
position: absolute;
top: 0;
left: 0;
opacity: 0.9;
}
.green {
height: 150px;
width: 80px;
background-color: green;
position: absolute;
top: 50px;
left: 80px;
}
JavaScript
$(".green").on("click", function () {
var greenBlk = $(this);
greenBlk.animate({
left: '+=80px'
}, function () {
greenBlk.css('zIndex', 50);
greenBlk.animate({
left: "-=80"
});
});
});
$(".red").on("click", function () {
var redBlk = $(this);
redBlk.animate({
left: '-=80px'
}, function () {
redBlk.css('zIndex', 100);
redBlk.animate({
left: "+=80"
});
});
});