WEBデザインの勉強

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

カテゴリ分けやソートができるjQueryプラグインMixItUp

f:id:mmmmofu:20160925170543p:plain

mixitup.kunkalabs.com
Get startedから記述が入手できる。
MixItUpのjQueryはCDNがある。

デモはこちら

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

<!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.0.min.js"></script>
<script src="http://cdn.jsdelivr.net/jquery.mixitup/latest/jquery.mixitup.min.js"></script>
<script>
$(function(){
  $('#Container').mixItUp();
});
</script>
</head>

<body>
<div class="controls">
  <button class="filter" data-filter="all">ぜんぶ</button>
  <button class="filter" data-filter=".category-1">みどり</button>
  <button class="filter" data-filter=".category-2">あお</button>
  <button class="filter" data-filter=".category-3">あか</button>
  <button class="filter" data-filter=".category-4">こい</button>
</div>
<div id="Container" class="container">
  <div class="mix category-1 category-4" data-myorder="1"><a href="#"><img src="img/01.png" alt="#"></a></div>
  <div class="mix category-1" data-myorder="2"><a href="#"><img src="img/02.png" alt="#"></a></div>
  <div class="mix category-1" data-myorder="3"><a href="#"><img src="img/03.png" alt="#"></a></div>
  <div class="mix category-2 category-4" data-myorder="4"><a href="#"><img src="img/04.png" alt="#"></a></div>
  <div class="mix category-2" data-myorder="5"><a href="#"><img src="img/05.png" alt="#"></a></div>
  <div class="mix category-2" data-myorder="6"><a href="#"><img src="img/06.png" alt="#"></a></div>
  <div class="mix category-3 category-4" data-myorder="7"><a href="#"><img src="img/07.png" alt="#"></a></div>
  <div class="mix category-3" data-myorder="8"><a href="#"><img src="img/08.png" alt="#"></a></div>
  <div class="mix category-3" data-myorder="9"><a href="#"><img src="img/09.png" alt="#"></a></div>
  <div class="gap"></div>
  <div class="gap"></div>
</div>
</body>
</html>
</body>
</html>
@charset "utf-8";
/* CSS Document */
@charset "utf-8";
/* CSS Document */
/* reset */
html,body,div,h1,ul,li,small {
  margin: 0;
  padding: 0;
  line-height: 1.0;
  font-family:
    "Hiragino Kaku Gothic ProN",
    Meiryo,
    sans-serif;
  box-sizing: border-box;
}
ul {
  list-style: none;
}
a {
  text-decoration: none;
}
img {
    max-width: 100%;
  border: none;
  vertical-align: bottom;
}

*{

}

body, button{
  font-family: 'Helvetica Neue', arial, sans-serif;
}

.controls{
  padding: 2%;
  color: #333;
}

label{
  font-weight: 300;
  margin: 0 .4em 0 0;
}

button{
  display: inline-block;
  padding: .5em .8em;
  background: #666;
  border: 0;
  color: #FFF;
  font-size: 16px;
  font-weight: 300;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1.0;
}

button.active{
  background: #68b8c4;
}

button:focus{
  outline: 0 none;
}

button + label{
  margin-left: 1em;
}

.container{
  padding: 2% 2% 0;
  text-align: justify;
  font-size: 0.1px;
  
  -webkit-backface-visibility: hidden;
}

.container:after{
  content: '';
  display: inline-block;
  width: 100%;
}

.container .mix,
.container .gap{
  display: inline-block;
  width: 49%;
}

.container .mix{
  text-align: left;
  margin-bottom: 2%;
  display: none;
}

.container .mix img {
  width: 100%;
  height: auto;
}

.container .mix:before{
  content: '';
  display: inline-block;
  padding-top: 60%;
}

@media all and (min-width: 420px){
  .container .mix,
  .container .gap{
    width: 32%;
  }
}

@media all and (min-width: 640px){
  .container .mix,
  .container .gap{
    width: 23.5%;
  }
}