View gist:560a3847860bace1d680
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
jQuery(document).ready(function($){ | |
var images = []; | |
{% for image in product.images %} | |
images.push({url: "{{ image | product_img_url: 'medium' }}", alt: "{{ image.alt }}"}); | |
{% endfor %} | |
var thumbnails = $(".thumbs"); |
View 0_reuse_code.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
View gist:6c956128048bd1a69821
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul> | |
{% comment %}A linklist should be created called "Collections" containing each of the "top" level collections{% endcomment %} | |
{% for link in linklists.collections.links %} | |
{% assign col = link.object %} | |
<li class="{% if col.handle == collection.handle %}active{% endif %}"> | |
<a href="{{ link.url }}"><span>{{ link.title }}</span></a> | |
{% if col.all_tags.size > 0 %} | |
<ul> | |
{% assign tag_index = 0 %} | |
{% assign current_tag = "" %} |
View gist:b9fd3e4f7532f9f19658
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign articles = blogs.news.articles | sort: 'title' %} | |
{% for article in articles %} | |
{{ article.title }}<br> | |
{% endfor %} |
View gist:1a18794a075dbbc0c3e4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% raw %} | |
<script id="recently-viewed-product-template" type="text/x-jquery-tmpl"> | |
{{each(prop, val) images}} | |
{{if val.toLowerCase().indexOf(".imagename") >= 0 }} | |
<div id="product-${handle}" class="product"> | |
<div class="image"> | |
<a href="${url}" class="cy"> | |
<img src="${Shopify.Products.resizeImage(val, "medium")}" /> | |
</a> | |
</div> |
View gist:928c5925dc07ffe487ba
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.single-option-selector').each(function() { | |
var numOptions = $(this).children().length; | |
if(numOptions == 1) { | |
$(this).hide(); | |
$(this).before( "<p>" + $(this).val() + "</p>"); | |
} | |
}); |
View gist:9691004
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for option in product.options %} | |
{% if option contains "Color" %} | |
{% assign optionName = "option" | append: forloop.index %} | |
{% assign colors = product.variants | map: optionName %} | |
{% assign colorsFiltered = '' %} | |
{% for colorOption in colors %} | |
{% unless colorsFiltered contains colorOption %} | |
{% assign colorsFiltered = colorsFiltered | append: ', ' | append: colorOption %} | |
{% endunless %} | |
{% endfor %} |
View gist:9665660
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign total = product.variants | map: 'available' | join: ", " | remove: 'false, ' %} | |
{% assign available = total | split: ',' %} | |
{{ available.size }} of {{ product.variants.size }} left |
View gist:9665395
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if product.options.size == 1 %} | |
{% for variant in product.variants %} | |
{% unless variant.available %} | |
jQuery('.single-option-selector option:contains(' + {{ variant.title | json }} +')').remove(); | |
{% endunless %} | |
{% endfor %} | |
jQuery('.single-option-selector').trigger('change'); | |
{% endif %} |
View gist:8851659
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign collection_tags = collection | map: 'tags' %} | |
{% for tag in collection_tags %} | |
<a href="/collections/{% if collection.handle != blank %}{{ collection.handle }}{% else %}all{% endif %}/{{ tag | handleize }}" title="{{ tag | escape }}">{{ tag }}</a> | |
{% endfor %} |
NewerOlder