<div class="contents">text</div>
<div class="cp_snslink10">
<div class="cp_link_list">
<input type="checkbox" id="cp_toggle" />
<label for="cp_toggle" class="share"></label>
<ul class="cp_link">
<li class="twitter"><a href="#" title="Twitter"></a></li>
<li class="facebook"><a href="#" title="Facebook"></a></li>
<li class="instagram"><a href="#" title="Instagram"></a></li>
</ul>
</div>
</div>
body {
/*設置する親要素ページ全体ならbodyなど*/
position: relative;
height: 100vh;
margin: 0;
padding: 0;
}
.contents {
/*サンプルはfixedの確認のためにheight指定しています。*/
height: 2000px;
}
.cp_snslink10 {
position: fixed;
top: 4%;
left: 1%;
display: block;
margin: 0;
transform: translateY(-50%);
width: 40%;
}
.cp_snslink10 .cp_link_list{
position: relative;
perspective: 1000px;
}
.cp_snslink10 .cp_link_list input{
display: none;
}
/*シェアボタン*/
.cp_snslink10 .cp_link_list label.share {
position: relative;
display: flex;
justify-content: center;
align-items: center;
width: 50px;
height: 50px;
background: #4DB6AC;
border-radius: 50%;
cursor: pointer;
transition: all 0.3s;
}
.cp_snslink10 .cp_link_list label.share::before{
position: absolute;
content: '';
background-image: url(https://copypet.jp/demo/sns/share_icon_white.svg);
background-size: contain;
background-repeat: no-repeat;
width: 25px;
height: 25px;
}
/*各種SNSリンク*/
.cp_snslink10 .cp_link_list .cp_link li {
position: absolute;
top: 0;/*最初の位置*/
left: 0;
opacity: 0;
display: flex;
align-items: center;
justify-content: center;
list-style: none;
margin: 0 0 10px 0;
padding: 0;
width: 50px;
height: 50px;
background: #F48FB1;
border-radius: 50%;
cursor: pointer;
transition: all 0.5s;
z-index: -1;
}
/*SNS各種ロゴ*/
.cp_snslink10 .cp_link .facebook::before,
.cp_snslink10 .cp_link .twitter::before,
.cp_snslink10 .cp_link .instagram::before {
position: absolute;
content: '';
background-size: contain;
background-repeat: no-repeat;
width: 25px;
height: 25px;
}
/*facebook*/
.cp_snslink10 .cp_link .facebook::before {
background-image: url(facebook_logo_secondary.svg);
}
/*twitter*/
.cp_snslink10 .cp_link .twitter::before {
background-image: url(x-logo.svg);
}
/*instagram*/
.cp_snslink10 .cp_link .instagram::before {
background-image: url(instagram_glyph_white.svg);
}
/* hover時の動きの設定 */
.cp_snslink10 .cp_link_list .cp_link li a {
display: block;
width: 100%;
height: 100%;
border-radius: 50%;
transition: all 0.3s;
}
.cp_snslink10 .cp_link_list .cp_link li:hover a {
background: #42A5F5;
}
/* シェアボタンクリック時の動きの設定 */
.cp_snslink10 .cp_link_list input:checked ~ label {
background: #EC407A;
}
.cp_snslink10 .cp_link_list input:checked ~ .cp_link li{
opacity: 1;
transform: translateY(0) rotate(360deg);
transition: all 0.3s;
}
.cp_snslink10 .cp_link_list input:checked ~ .cp_link li.twitter{
left: 60px;
transition-delay: 0;
z-index: 4;
}
.cp_snslink10 .cp_link_list input:checked ~ .cp_link li.facebook{
left: 120px;
transition-delay: 0.3s;
z-index: 3;
}
.cp_snslink10 .cp_link_list input:checked ~ .cp_link li.instagram{
left: 180px;
transition-delay: .6s;
z-index: 2;
}