{% block stylesheet %}
<style>
{# タイトル #}
.ec-secHeading span.ec-secHeading__ja {
color: #000;
font-size: 18px;
font-style: normal;
font-weight: 700;
line-height: 24px;
letter-spacing: normal;
vertical-align: 0px;
}
{# 商品画像 #}
.ec-historyRole__listImage {
margin-bottom: 8px;
}
.ec-historyRole__listImage img {
width: 96px;
height: 96px;
object-fit: cover;
border-radius: 96px;
}
.ec-historyRole__listItemTitle {
color: #000;
text-align: center;
font-size: 14px;
font-style: normal;
font-weight: 600;
line-height: 18px;
width: 96px;
display: -webkit-box; /* flexboxの一種(省略に必要) */
-webkit-line-clamp: 2; /* 最大行数 */
-webkit-box-orient: vertical; /* 縦方向に行を積む */
overflow: hidden; /* 溢れた部分を非表示 */
text-overflow: ellipsis; /* … を表示 */
word-break: break-word; /* 長い単語も折り返す */
}
.recently_product .item {
margin-right: 10px;
}
/* モバイル(幅767px以下) */
@media screen and (max-width: 767px) {
.ec-historyRole__listImage img {
width: 80px;
height: 80px;
object-fit: cover;
border-radius: 80px;
}
.ec-historyRole__listItemTitle {
font-size: 12px;
font-weight: 600;
line-height: 18px;
width: 80px;
}
.ec-role {
padding-left: 0px;
padding-right: 0px;
}
.recently_product {
margin-left: 16px;
}
.ec-secHeading {
margin-left: 16px;
}
.recently_product .item {
margin-right: 0px;
}
}
</style>
{% endblock %}
{% block javascript %}
<script>
$(function() {
$('.recently_product').slick({
dots: false,
autoplay: true,
autoplaySpeed: 1000,
centerMode: false, // 中央寄せしない
variableWidth: true, // スライド幅に合わせて並べる(左寄せにしやすい)
centerPadding: '1%',
arrows: false,
infinite: false,
slidesToShow: 9,
swipeToSlide: true
});
});
</script>
{% endblock javascript %}
{% if RecentlyViewedProducts|length > 0 %}
<div class="ec-role" style="margin-bottom: 24px;">
<div class="ec-historyRole">
<div class="ec-historyRole__heading">
<div class="ec-secHeading">
<span class="ec-secHeading__ja">最近閲覧した商品</span>
</div>
</div>
<div class="recently_product" style="">
{% for Product in RecentlyViewedProducts %}
<div class="item slick-slide" style="">
<a href="{{ url('product_detail', {id: Product.id}) }}">
<div class="ec-historyRole__listImage">
<img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" style="background: url('{{ asset(Product.main_list_image|no_image_product, 'save_image') }}') lightgray 50% / cover no-repeat;" alt="{{ Product.name }}" loading="lazy">
</div>
<p class="ec-historyRole__listItemTitle">{{ Product.name }}</p>
</a>
</div>
{% endfor %}
</div>
</div>
</div>
{% endif %}