spoilerを画像にだけ適用するように変更

This commit is contained in:
eai04191 2020-01-13 11:23:20 +09:00
parent 9f565798c0
commit 5e9fa05be5
3 changed files with 24 additions and 14 deletions

View File

@ -96,9 +96,11 @@ $(() => {
}
});
$(document).on('click', '.card-spoiler-overlay', function (event) {
$(document).on('click', '.card-spoiler-wrap', function (event) {
const $this = $(this);
$this.siblings(".card-link").removeClass("card-spoiler");
const $card = $this.siblings(".card-link");
$card.removeClass("card-spoiler");
$card.find('.card-img-spoiler-overlay').remove();
$this.remove();
});
});

View File

@ -31,15 +31,25 @@
white-space: pre-line;
}
.card-spoiler-overlay {
.card-spoiler-wrap {
position: absolute;
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
cursor: pointer;
}
.card-spoiler img{
z-index: 1;
filter: blur(15px) grayscale(100%);
}
.card-img-spoiler-overlay {
position: absolute;
z-index: 2;
display: flex;
align-items: center;
justify-content: center;
.warning-text {
padding: 10px;
@ -48,9 +58,4 @@
border-radius: 5px;
}
}
.card-spoiler {
z-index: 1;
filter: blur(15px) grayscale(100%);
}
}

View File

@ -1,12 +1,15 @@
<div class="card link-card mb-2 px-0 col-12 d-none" style="font-size: small;">
@if ($is_too_sensitive)
<div class="card-spoiler-overlay">
<span class="warning-text">クリックまたはタップで表示</span>
</div>
<div class="card-spoiler-wrap"> </div>
@endif
<a class="text-dark card-link {{ $is_too_sensitive ? 'card-spoiler' : '' }}" href="{{ $link }}" target="_blank" rel="noopener">
<div class="row no-gutters">
<div class="col-12 col-md-6 justify-content-center align-items-center">
@if ($is_too_sensitive)
<div class="card-img-spoiler-overlay">
<span class="warning-text">クリックまたはタップで表示</span>
</div>
@endif
<img src="" alt="Thumbnail" class="w-100 bg-secondary">
</div>
<div class="col-12 col-md-6">