Reputation: 1
I'm using a fancyzoom jQuery plugin on a Shopify site, and I need to specify a directory path for the shadows, closebox, etc images.
Here is the jQuery plugin language:
var zoomImagesURI = 'DirectoryStringGoesHere/'; // Location of the zoom and shadow images
inImage2.setAttribute('src',zoomImagesURI+'closebox.png');
A similar question to mine was asked here, and the answer is bascially to use the Shopify API. The useful bits of the API that I found are these:
key
{ "key" : "assets/bg-body-green.gif"}
The path to the asset within a shop. For example, the asset bg-body-green.gif is located in the assets folder.
public_url
{ "public_url" : "http://static.shopify.com/assets/bg.gif?1"}
The public facing URL of the asset.
This seems like it should be simple, yet I could not get this to work for me. Any suggestions?
Thanks, Nick
Upvotes: 0
Views: 527
Reputation: 11427
Why don't you just use Liquid and use the asset_url filter. That's one way to do it with no chance of failure.
eg:
var fizzbuzz = "{{ 'some_asset.png' | asset_url }}";
Upvotes: 1