WEBデザインの勉強

WEB制作初心者が1から勉強するブログ。

要素が下から上に表示されるアニメーション

f:id:mmmmofu:20161020162108p:plain

下から上が上手くいかなかったのでメモ

デモはこちら

http://efu.sakura.ne.jp/web/btmtop/

<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <title>下から上に表示していくアニメーション</title>
    <link rel="stylesheet" href="style.css">
    <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
    <script src="jquery.easing.1.3.js"></script>
    <script src="script.js"></script>
</head>
<body>
   <div class="wrapper">
        <ul class="clearfix">
            <li class="n01"><div></div></li>
            <li class="n02"><div></div></li>
            <li class="n03"><div></div></li>
            <li class="n04"><div></div></li>
            <li class="n05"><div></div></li>
        </ul>
    </div>
</body>
</html>
/* http://meyerweb.com/eric/tools/css/reset/
   v2.0 | 20110126
   License: none (public domain)
*/

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 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
  display: block;
}
body {
  line-height: 1;
}
ol, ul {
  list-style: none;
}
blockquote, q {
  quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
  content: '';
  content: none;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}

.wrapper {
  width: 500px;
  height: 700px;
  margin: 0 auto;
}
ul li {
  width: 100px;
  height: 700px;
  position: relative;
  float: left;
}
ul li div {
  width: 100px;
  height: 0;
  position: absolute;
  bottom: 0;
  left: 0;
}
.n01 div {
  background: url("img/01.png") no-repeat center bottom;
}

.n02 div {
  background: url("img/02.png") no-repeat center bottom;
}

.n03 div {
  background: url("img/03.png") no-repeat center bottom;
}

.n04 div {
  background: url("img/04.png") no-repeat center bottom;
}

.n05 div {
  background: url("img/05.png") no-repeat center bottom;
}
$(function(){
    var speed = 180;
    $('ul li').each(function(i){
        $(this).find('div').delay( i * ( speed ) ).animate( {'height':600},750,'easeInOutCubic');
    });
});