Twitter bootstrap 3 Shopify引导旋转木马
我正在为shopify开发一个引导转盘,首先,我发现它们显示的正确图像数量的指示器有问题。但在第二个指示器点击该指示器后,它不再工作Twitter bootstrap 3 Shopify引导旋转木马,twitter-bootstrap-3,shopify,Twitter Bootstrap 3,Shopify,我正在为shopify开发一个引导转盘,首先,我发现它们显示的正确图像数量的指示器有问题。但在第二个指示器点击该指示器后,它不再工作 {%用于product.images%中的图像} {%if-forloop.first%} {%else%} {%endif%} {%endfor%} {%assign characterized_image=product.selected_或_first_available_variant.characterized_image |默认值:produc
{%用于product.images%中的图像}
{%if-forloop.first%}
{%else%}
{%endif%}
{%endfor%}
{%assign characterized_image=product.selected_或_first_available_variant.characterized_image |默认值:product.characterized_image%}
{如果计数\u图像>0%}
{%用于产品中的图像。图像偏移量:1%}
{%endfor%}
{%endif%}
您的代码有几个问题。第一个是所有后续指标都以第二个图像为目标。
第二个是特色图片通常是第一个图片,但是没有保证,所以你需要测试你的图片是否是特色图片
尝试:
{%assign characterized_image=product.selected_或_first_available_variant.characterized_image |默认值:product.characterized_image%}
{%用于product.images%中的图像}
{%assign activeClass=''%}
{%if\u image.id==image.id%}{%assign-activeClass='active%}{%endif%}
{%endfor%}
{%用于product.images%中的图像}
{%assign activeClass=''%}
{%if\u image.id==image.id%}{%assign-activeClass='active%}{%endif%}
{%endfor%}
您的代码有几个问题。第一个是所有后续指标都以第二个图像为目标。
第二个是特色图片通常是第一个图片,但是没有保证,所以你需要测试你的图片是否是特色图片
尝试:
{%assign characterized_image=product.selected_或_first_available_variant.characterized_image |默认值:product.characterized_image%}
{%用于product.images%中的图像}
{%assign activeClass=''%}
{%if\u image.id==image.id%}{%assign-activeClass='active%}{%endif%}
{%endfor%}
{%用于product.images%中的图像}
{%assign activeClass=''%}
{%if\u image.id==image.id%}{%assign-activeClass='active%}{%endif%}
{%endfor%}
比我当前的代码工作得更好,但指示灯仍处于关闭状态。为什么?你有样本页吗?在最后一张图片前已经关闭了是的。很抱歉,我正在查看您的原始代码,没有正确地回忆幻灯片。示例已修复。比我当前的代码工作得更好,但指标仍处于关闭状态。为什么?你有样本页吗?在最后一张图片前已经关闭了是的。很抱歉,我正在查看您的原始代码,没有正确地回忆幻灯片。样本是固定的。
<div id="carousel" class="carousel slide">
{% assign featured_image = product.selected_or_first_available_variant.featured_image | default: product.featured_image %}
<!-- Indicators -->
<ol class="carousel-indicators">
{% for image in product.images %}
{% assign activeClass = '' %}
{% if featured_image.id == image.id %} {% assign activeClass = 'active' %}{% endif %}
<li data-target="#carousel" data-slide-to="{{forloop.index0}}" class="{{activeClass}}"></li>
{% endfor %}
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
{% for image in product.images %}
{% assign activeClass = '' %}
{% if featured_image.id == image.id %} {% assign activeClass = 'active' %}{% endif %}
<div class="item {{activeClass}}">
<img src="{{ image | img_url }}" class="img-responsive" alt="{{ product.title }}" style="min-height: 115px !important;" />
</div>
{% endfor %}
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel" data-slide="prev">
<span class="fa fa-arrow-left"></span>
</a>
<a class="right carousel-control" href="#carousel" data-slide="next">
<span class="fa fa-arrow-right"></span>
</a>
</div>