【问题标题】:Shopify: Using an Assets directory string with a jquery pluginShopify:使用带有 jquery 插件的资产目录字符串
【发布时间】:2013-07-26 19:23:22
【问题描述】:

我在 Shopify 网站上使用了一个 fancyzoom jQuery 插件,我需要为阴影、closebox 等图像指定一个目录路径。

这里是 jQuery 插件语言:

var zoomImagesURI   = 'DirectoryStringGoesHere/'; // Location of the zoom and shadow images


inImage2.setAttribute('src',zoomImagesURI+'closebox.png');      

here 提出了与我类似的问题,答案基本上是使用 Shopify API。我发现的 API 的有用部分如下:

{ "key" : "assets/bg-body-green.gif"}

商店内资产的路径。例如,资产 bg-body-green.gif 位于 assets 文件夹中。

public_url

{ "public_url" : "http://static.shopify.com/assets/bg.gif?1"}

资产的面向公众的 URL。

这似乎应该很简单,但我无法让它为我工作。有什么建议么?

谢谢,尼克

【问题讨论】:

    标签: jquery shopify


    【解决方案1】:

    为什么不直接使用 Liquid 并使用asset_url 过滤器。这是一种不会失败的方法。

    例如:

    var fizzbuzz = "{{ 'some_asset.png' | asset_url }}";
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多