【发布时间】:2020-11-07 11:32:04
【问题描述】:
<section class="image-slider">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
{% for block in section.blocks %}
<li data-target="#carouselExampleIndicators" data-slide-to="{{forloop.index0}}" {%if forloop.index0 == 0 %} class="active" {% endif %}></li>
{% endfor %}
</ol>
<div class="carousel-inner">
{% for block in section.blocks %}
<div class="carousel-item {% if forloop.first %} active {% endif %} ">
<img src="{{block.settings.image | img_url: 'master'}}">
<div class="carousel-caption d-none d-md-block">
<h5 class="title-color">{{block.settings.title}}</h5>
</div>
</div>
<style>
.title-color{
color: {{ block.settings.title_color }};
}
</style>
{% endfor %}
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</section>
{% schema %}
{
"name": "Image Slider",
"max_blocks": 5,
"settings": [
{
"type": "header",
"content": "Image Slider"
}
],
"blocks": [
{
"type": "image",
"name": "Image",
"settings": [
{
"type": "image_picker",
"id": "image",
"label": "Image"
},
{
"type": "text",
"id": "title",
"label": "Image Title"
},
{
"type": "color",
"id": "title_color",
"label": "Title Color",
"default": "#ffffff"
}
]
}
],
"presets": [
{
"category": "Image",
"name":"Image Slider"
}
]
}
{% endschema %}
我正在学习 shopify 并遇到有关获取 css 字体颜色的问题。它工作正常我可以从颜色选择器中选择字体颜色,它正在应用于我的幻灯片,但问题是当我添加新幻灯片并更改其标题字体颜色时,它会应用颜色并覆盖以前的幻灯片标题颜色并应用新的所有幻灯片的幻灯片标题颜色。我知道我在这里遗漏了一些东西。我希望每张幻灯片的幻灯片标题颜色以及其他字体样式都不同。
【问题讨论】:
标签: html css shopify shopify-app shopify-template