Skip to content

Instantly share code, notes, and snippets.

@dooman87
Created March 26, 2019 23:00
Show Gist options
  • Save dooman87/0e05fbab5dc9d98c691e5a65f839d982 to your computer and use it in GitHub Desktop.
Save dooman87/0e05fbab5dc9d98c691e5a65f839d982 to your computer and use it in GitHub Desktop.
{% case section.settings.image_size %}
{% when 'small' %}
{%- assign product_image_width_pixels = 1120 | divided_by: 3 | minus: 30 -%}
{%- assign product_image_width = 'medium-up--one-third' -%}
{%- assign product_description_width = 'medium-up--two-thirds' -%}
{%- assign product_thumbnail_width = 'medium-up--one-third' -%}
{%- assign height = 345 -%}
{% when 'medium' %}
{%- assign product_image_width_pixels = 1120 | divided_by: 2 | minus: 30 -%}
{%- assign product_image_width = 'medium-up--one-half' -%}
{%- assign product_description_width = 'medium-up--one-half' -%}
{%- assign product_thumbnail_width = 'medium-up--one-quarter' -%}
{%- assign height = 530 -%}
{% when 'large' %}
{%- assign product_image_width_pixels = 1120 | divided_by: 3 | times: 2 | minus: 30 -%}
{%- assign product_image_width = 'medium-up--two-thirds' -%}
{%- assign product_description_width = 'medium-up--one-third' -%}
{%- assign product_thumbnail_width = 'medium-up--one-fifth' -%}
{%- assign height = 720 -%}
{% when 'full' %}
{%- assign product_image_width_pixels = 1120 | minus: 30 -%}
{%- assign product_image_width = '' -%}
{%- assign product_description_width = '' -%}
{%- assign product_thumbnail_width = 'medium-up--one-eighth' -%}
{%- assign height = 1090 -%}
{%- assign enable_zoom = false -%}
{% endcase %}
....
<img data-pb-image
id="{{ img_id }}"
data-src="{{ image | img_url: 'master' | url_encode }}"
data-lazy=""
data-op="resize?size={{product_image_width_pixels}}"
class="feature-row__image {{ img_class }} lazyload{% unless featured_image == image %} lazypreload{% endunless %}"
alt="{{ image.alt | escape }}"
tabindex="-1"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment