コミュニティのコメント
-
▼HTML
<script>
var scAccordionBtn = scAccordionBtn || {};
(function(_) {
const target = ‘.js-accordion’;
_.method = function(el) {
const btn = el.querySelector(‘.accordion-btn’);
const contents = el.querySelector(‘.accordion-contents’);
contents.classList.add(‘is-hide’);
btn.addEventListener(‘click’, function() {
contents.classList.toggle(‘is-hide’);
this.classList.toggle(‘is-open’);
});
}
_.init = function() {
Array.from(document.querySelectorAll(target), el => {
_.method(el);
});
};
})(scAccordionBtn);
</script>
<script>
document.addEventListener(‘DOMContentLoaded’, scAccordionBtn.init, false);
</script>
<div class=”accordion-wrap js-accordion”>
<div class=”accordion-btn mark”>
ボタンのテキストが入ります
</div>
<div class=”accordion-contents”>
<div class=”wrap-table-compare”>
<table class=”table-compare”>
<thead>
<tr>
<th><span style=”font-size: 17px;” class=”sb-fs-free”>機能一覧</span></th>
<th><span style=”font-size: 17px;” class=”sb-fs-free”>機能詳細</span></th>
<th><span style=”font-size: 17px;” class=”sb-fs-free”>利便性</span></th>
<th><span style=”font-size: 17px;” class=”sb-fs-free”>カテゴリ</span></th>
</tr>
</thead>
<tbody>
<tr>
<td><a href=”#”>
<figure class=”icon”>
<picture>
<source type=”image/webp” srcset=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112731/b470a448-1d07-452d-acec-196f15f74017.webp”>
<source type=”image/avif” srcset=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112731/b470a448-1d07-452d-acec-196f15f74017.avif”><img src=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112731/b470a448-1d07-452d-acec-196f15f74017.PNG” width=”97″ height=”65″ draggable=”false” class=”lazyload”>
</picture>
</figure>
</a></td>
<td><span style=”font-size: 11px;” class=”sb-fs-free”>全国の雨雲レーダーを5分間隔、60時間先まで確認出来る</span></td>
<td><span style=”font-size: 11px;” class=”sb-fs-free”></span><span class=”symbol circle double red sb-fs-free”></span></td>
<td>
<span class=”tag pink”>雨雲レーダー</span><span class=”tag blue”>全国の天気</span><span class=”tag green”>現在地の天気</span><span class=”tag yellow”>外出の目安</span>
</td>
</tr>
<tr>
<td><a href=”#”>
<figure class=”icon”>
<picture>
<source type=”image/webp” srcset=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112737/d08f7543-dec1-45cf-a64e-92e573ef1eba.webp”>
<source type=”image/avif” srcset=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112737/d08f7543-dec1-45cf-a64e-92e573ef1eba.avif”><img src=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112737/d08f7543-dec1-45cf-a64e-92e573ef1eba.PNG” width=”97″ height=”65″ draggable=”false” class=”lazyload”>
</picture>
</figure>
</a></td>
<td><span style=”font-size: 11px;” class=”sb-fs-free”>台風の発生、進路、強さなど台風の詳細情報を確認出来る</span></td>
<td><span class=”symbol circle double red”></span></td>
<td>
<span class=”tag pink”>台風詳細</span><span class=”tag blue”>台風の進路</span><span class=”tag green”>台風の強さ</span><span class=”tag yellow”>台風の影響</span>
</td>
</tr>
<tr>
<td><a href=”#”>
<figure class=”icon”>
<picture>
<source type=”image/webp” srcset=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112739/81dcf604-f3b2-415e-a2c9-068681869ebd.webp”>
<source type=”image/avif” srcset=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112739/81dcf604-f3b2-415e-a2c9-068681869ebd.avif”><img src=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112739/81dcf604-f3b2-415e-a2c9-068681869ebd.PNG” width=”97″ height=”65″ draggable=”false” class=”lazyload”>
</picture>
</figure>
</a></td>
<td><span style=”font-size: 11px;” class=”sb-fs-free”>全国の週間天気が確認出来る</span></td>
<td><span class=”symbol circle double red”></span></td>
<td>
<span class=”tag pink”>週間天気</span><span class=”tag blue”>全国の天気</span><span class=”tag green”>天気予報</span><span class=”tag yellow”>外出の目安</span>
</td>
</tr>
<tr>
<td><a href=”#”>
<figure class=”icon”>
<picture>
<source type=”image/webp” srcset=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112740/7038c014-4081-4f78-a5f2-3fe7f3af5f0b.webp”>
<source type=”image/avif” srcset=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112740/7038c014-4081-4f78-a5f2-3fe7f3af5f0b.avif”><img src=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112740/7038c014-4081-4f78-a5f2-3fe7f3af5f0b.PNG” width=”97″ height=”65″ draggable=”false” class=”lazyload”>
</picture>
</figure>
</a></td>
<td><span style=”font-size: 11px;” class=”sb-fs-free”>天気に関する様々なニュースをお届け</span></td>
<td><span class=”symbol circle red”></span></td>
<td>
<span class=”tag pink”>全国の出来事</span><span class=”tag blue”>服装チェック</span><span class=”tag green”>旬のニュース</span><span class=”tag yellow”>キャスター</span>
</td>
</tr>
<tr>
<td><a href=”#”>
<figure class=”icon”>
<picture>
<source type=”image/webp” srcset=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112761/af6d0118-293f-40e9-a5d4-46f628ff3118.webp”>
<source type=”image/avif” srcset=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112761/af6d0118-293f-40e9-a5d4-46f628ff3118.avif”><img src=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112761/af6d0118-293f-40e9-a5d4-46f628ff3118.PNG” width=”97″ height=”65″ draggable=”false” class=”lazyload”>
</picture>
</figure>
</a></td>
<td><span style=”font-size: 11px;” class=”sb-fs-free”>全国の熱中症情報が確認出来る</span></td>
<td><span class=”symbol circle double red”></span></td>
<td>
<span class=”tag pink”>熱中症情報</span><span class=”tag blue”>熱中症リスク</span><span class=”tag green”>全国の気温</span><span class=”tag yellow”>熱中症対策</span>
</td>
</tr>
<tr>
<td><a href=”#”>
<figure class=”icon”>
<picture>
<source type=”image/webp” srcset=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112764/e366102b-d1e0-4c91-b663-205ad13e11c6.webp”>
<source type=”image/avif” srcset=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112764/e366102b-d1e0-4c91-b663-205ad13e11c6.avif”><img src=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112764/e366102b-d1e0-4c91-b663-205ad13e11c6.PNG” width=”97″ height=”65″ draggable=”false” class=”lazyload”>
</picture>
</figure>
</a></td>
<td><span style=”font-size: 11px;” class=”sb-fs-free”>全国のゲリラ豪雨・雷情報が3時間先まで確認出来る</span></td>
<td><span class=”symbol circle double red”></span></td>
<td>
<span class=”tag pink”>ゲリラ豪雨</span><span class=”tag blue”>全国の天気</span><span class=”tag green”>雨対策</span><span class=”tag yellow”>雷対策</span>
</td>
</tr>
<tr>
<td><a href=”#”>
<figure class=”icon”>
<picture>
<source type=”image/webp” srcset=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112766/04822f5d-9e77-4370-86ee-c14fb4a6a069.webp”>
<source type=”image/avif” srcset=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112766/04822f5d-9e77-4370-86ee-c14fb4a6a069.avif”><img src=”https://file.mysquadbeyond.com/uploads/article_photo/photo/3112766/04822f5d-9e77-4370-86ee-c14fb4a6a069.PNG” width=”97″ height=”65″ draggable=”false” class=”lazyload”>
</picture>
</figure>
</a></td>
<td><span style=”font-size: 11px;” class=”sb-fs-free”>全国各地の方が地域ごとの天気情報を<br>投稿してくれる</span></td>
<td><span class=”symbol circle red”></span></td>
<td>
<span class=”tag pink”>投稿リポート</span><span class=”tag blue”>全国の天気</span><span class=”tag green”>空模様・気温</span><span class=”tag yellow”>風の強さ</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
-
▼CSS
.accordion-wrap {
font-size: 14px;
max-width: 750px;
margin-left: auto;
margin-right: auto;
}
.accordion-btn {
width: 80%;
margin-left: auto;
margin-right: auto;
margin-bottom: 2em;
text-align: center;
background-color: #6ad1c8;
color: #fff;
border-radius: 99px;
padding: 0.25em 0;
cursor: pointer;
font-size: 1em;
transition: 0.25s;
}
.accordion-btn.mark::before {
content: “▶︎”;
display: inline-block;
color: #fff;
margin: 0 0.5em 0 0;
transition: 0.25s;
}
.accordion-btn.mark.is-open::before {
rotate: 90deg;
}
.accordion-btn:hover {
opacity: .8;
}
.accordion-contents {
line-height: 2;
transition: opacity 0.75s, max-height 0.25s;
}
.accordion-contents.is-hide {
opacity: 0;
max-height: 0;
overflow: hidden;
}
.check-list {
border: solid 2px #6ad1c8;
padding: 1em;
background-color: #fff;
box-shadow: 2px 2px 1px #ccc;
position: relative;
margin: 2em 0;
}
.check-list-title {
color: #5bb8af;
background-color: #fff;
width: fit-content;
padding: 0.25em 1em;
position: absolute;
top: -1.5em;
font-weight: 600;
}
.check-list-item {
display: flex;
align-items: center;
gap: 0.5em;
}
.check-list-item::before {
content: “”;
display: block;
width: 1em;
aspect-ratio: 1/1;
background: url(https://file.mysquadbeyond.com/uploads/article_photo/photo/2826160/4ae5a437-4c8b-4731-b3b0-0ae497a7b2bb.svg) no-repeat 0 0/contain;
}
@media (max-width: 500px) {
.accordion-wrap {
font-size: 3.3vw;
}
}
.wrap-table-compare {
max-width: 100%;
width: 800px;
margin: 0 auto;
}
.table-compare {
width: 100%;
table-layout: fixed;
border-collapse: collapse;
border-spacing: 0;
text-align: center;
font-size: 14px;
line-height: 1.4;
}
.table-compare th {
background-color: #00cdde;
border: 1px solid #00cdde;
color: #fff;
font-weight: bold;
padding: 25px 0;
width: 20%;
font-size: 12px;
}
.table-compare td {
border: 1px solid #cccccc;
}
.table-compare a {
text-decoration: none;
}
.table-compare .icon {
margin: 0 auto;
width: 80%;
box-sizing: border-box;
}
.table-compare .icon img {
max-width: 100%;
height: auto;
vertical-align: bottom;
}
.table-compare .icon figcaption {
font-size: 10px;
color: #000000;
}
.table-compare .symbol {
position: relative;
display: inline-block;
width: 52px;
height: 52px;
}
.table-compare .symbol.circle::before {
content: “”;
display: inline-block;
width: 100%;
height: 100%;
border: 7px solid #000;
border-radius: 50%;
box-sizing: border-box;
}
.table-compare .symbol.double::after {
content: “”;
display: inline-block;
width: 50%;
height: 50%;
position: absolute;
top: 25%;
left: 25%;
border: 7px solid #000;
border-radius: 50%;
box-sizing: border-box;
}
.table-compare .symbol.red::before,
.table-compare .symbol.red::after {
border-color: #e60033;
}
.table-compare .symbol.yellow::before,
.table-compare .symbol.yellow::after {
border-color: #f8b500;
}
.table-compare .note {
font-size: 10px;
}
.table-compare .tag {
display: block;
width: 80%;
border-radius: 5%;
margin: 5px auto;
box-shadow: 1px 1px 1px #dbdbdb;
font-size: 10px;
color: #fff;
padding: 4px 3px;
}
.table-compare .tag.pink {
background-color: #ed49b4;
}
.table-compare .tag.blue {
background-color: #2D2DBB;
}
.table-compare .tag.green {
background-color: #069100;
}
.table-compare .tag.yellow {
background-color: #f0b137;
}
-
失礼しましたmm
こちらで大丈夫そうでしょうか?
<a href=”https://sb-draft-preview.squadbeyond.com/articles/BHnhnoSEmxZhqikbww/draft?token=575454eba187436203bb7a3dac8fc47a”>sb-draft-preview.squadbeyond.com/articles/BHnhnoSEmxZhqikbww/draft?token=575454eba187436203bb7a3dac8fc47a</a>
<a href=”https://sb-draft-preview.squadbeyond.com/articles/ePvkfaLmzQYkM-mlVPDw/draft?token=c82f9ae1d2c1f45dc9ec5e0f39453e8f”>sb-draft-preview.squadbeyond.com/articles/ePvkfaLmzQYkM-mlVPDw/draft?token=c82f9ae1d2c1f45dc9ec5e0f39453e8f</a>
-
ありがとうございます!やってみたのですがボタンが開かずでどこか間違っている可能性あるので、設置してあるHTMLとCSSをお送りします。
お手数ですが、ご確認お願いいたします。
-
<a href=”https://app.squadbeyond.com/ab_tests/01_101_7_2_31435601/articles#NNS_BsBbEVTAD-uKCAtw”>エディター | Squad beyond</a>
バージョン名はこちらです!
監修用