Skip to content

Instantly share code, notes, and snippets.

@matsuhisa
Last active December 10, 2016 10:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matsuhisa/ab3d5fab1373277135c1eb889b8a3e42 to your computer and use it in GitHub Desktop.
Save matsuhisa/ab3d5fab1373277135c1eb889b8a3e42 to your computer and use it in GitHub Desktop.
navi-horizontal.scss
%section.navi-horizontal2
.navi-horizontal2__scroll
%ul.navi-horizontal2__scroll__list
%li
.navi-item
.inavi-item__title Apple
%img{src: 'https://farm6.staticflickr.com/5553/30703927856_188964ae21_q_d.jpg'}
%li りんご
%li ふじ
%li 紅玉
%li 王林
%li Apple
%li りんご
%li ふじ
%li 紅玉
%li 王林
@mixin navi-horizontal ($item-width: 200px, $scroll-height: auto, $item-margin: 10px){
overflow: hidden;
width: 100%;
margin: 0;
padding: 0;
&__scroll {
overflow-x: auto;
width: 100%;
-webkit-overflow-scrolling: touch;
height: $scroll-height;
&__list {
display: inline-table;
overflow-x: auto;
margin: 0 - $item-margin;
padding: 0;
border-collapse: separate;
border-spacing: $item-margin 0;
&div, article, li {
display: table-cell;
min-width: $item-width;
@content;
}
}
}
}
%navi-item {
background-color: #336699;
margin-right: 10px;
img {
border: 1px solid red;
}
}
.navi-item {
background: #e7e7e7;
&__title {
font-weight: bold;
}
img{
border: 1px solid blue;
}
}
.navi-horizontal2 {
@include navi-horizontal($item-width: 200px, $scroll-height: 200px, $item-margin: 10px){
@extend %navi-item;
};
}
.navi-horizontal {
@include navi-horizontal(150px, 100px){
margin-right: 10px;
border: 1px solid red;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment