【问题标题】:Using Shopify's Liquid to create custom button background color in a custom theme section.使用 Shopify 的 Liquid 在自定义主题部分创建自定义按钮背景颜色。
【发布时间】:2017-11-24 16:31:18
【问题描述】:

我在 Shopify 中创建了一个名为 Slideshow with Button 的新主题部分。我一直在添加允许客户端成功添加自己的按钮文本的功能,但现在在尝试创建自定义按钮背景颜色的功能时卡住了。主要问题是流动代码没有填充 CSS。这是我现在的液体部分文件中的内容:

             {% if block.settings.link != blank %}
             <a href="{{ block.settings.link }}" class="dynamic_button_link">
             {% endif %}

            <style>
                .dynamic-button {
                  background-color:{{ section.settings.button_bg_color }}!important;
                  z-index:999;
                 }
            </style> 

              {% unless block.settings.button_text == blank %}
                <div class='dynamic-button'>{{ block.settings.button_text | escape }}</div>
              {% endunless %}

              {% if block.settings.link != blank %}
              </a>
              {% endif %}

            {
            "type": "color",
            "id": "button_bg_color",
            "label": "Background color",
            "default": "#ffffff"
           },

颜色选择器正常显示,但是...

显然动态颜色类型没有按预期填充 CSS...

任何帮助将不胜感激。谢谢。

【问题讨论】:

    标签: html css dynamic shopify liquid


    【解决方案1】:

    这个{{ section.settings.button_bg_color }}应该是这个{{ block.settings.button_bg_color }}

    【讨论】:

      猜你喜欢
      • 2018-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-12
      • 1970-01-01
      相关资源
      最近更新 更多