Guest User

Untitled

a guest
Jul 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.63 KB | None | 0 0
  1. {%- if section.settings.image -%}
  2. {%- assign img_object = section.settings.image -%}
  3. {%- assign img_small = section.settings.image | img_url: '18x' -%}
  4. {%- assign img_api = section.settings.image | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}
  5. {%- else -%}
  6. {%- assign img_object = 'blank.svg' | asset_url -%}
  7. {%- assign img_small = 'blank.svg' | asset_url -%}
  8. {%- assign img_api = 'blank.svg' | asset_url -%}
  9. {%- endif -%}
  10. <div class="homepage-image banner-desktop fade-in-child preventOverflow {{ section.settings.height }} {{ section.settings.color }}" data-section-id="{{ section.id }}" data-section-type="parallax" id="FeaturedImage-{{ section.id }}"
  11. {% if section.settings.parallax %}
  12. data-parallax-src="{{ img_small }}"
  13. data-src="{{ img_api }}"
  14. data-widths="[180, 360, 540, 720, 900, 1080, 1296, 1512, 1728, 2048, 2450, 2700, 3000, 3350, 3750, 4100, 4480]"
  15. data-aspectratio="{{ section.settings.image.aspect_ratio }}"
  16. data-sizes="auto"
  17. style="background-image: url('{{ section.settings.image | img_url: '1x1' }}');"
  18. {% endif %}>
  19. {% if section.settings.link_text == '' and section.settings.link and section.settings.button_image == nil %}
  20. <a href="{{ section.settings.link }}">
  21. {% endif %}
  22. <div class="content--centered">
  23. <div class="{{ section.settings.text_align }} preventOverflowContent">
  24. {%- if section.settings.button_image -%}
  25. {%- assign img_button = section.settings.button_image | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}
  26. <a href="{{ section.settings.link }}">
  27. <img class="lazyload image--flex"
  28. alt="{{ section.settings.button_image.alt | default: section.settings.link_text }}"
  29. src="{{ section.settings.button_image | img_url: '180x' }}"
  30. data-src="{{ img_button }}"
  31. data-widths="[180, 360, 540, 720, 900, 1080, 1296, 1512, 1728, 2048, 2450, 2700, 3000, 3350, 3750, 4100, 4480]"
  32. data-aspectratio="{{ section.settings.button_image.aspect_ratio }}"
  33. data-sizes="auto"/>
  34. <noscript>
  35. <img src="{{ section.settings.button_image | img_url: '540x' }}" alt="{{ section.settings.button_image.alt | default: section.settings.link_text }}" class="image--flex" />
  36. </noscript>
  37. </a>
  38. {%- else -%}
  39. {% unless section.settings.title == '' %}<h1 class="title--flex">{{ section.settings.title | escape }}</h1>{% endunless %}
  40. {% unless section.settings.description == '' %}<p class="content--flex h4--body">{{ section.settings.description }}</p>{% endunless %}
  41. {% unless section.settings.link_text == '' %}<a class="{{ section.settings.button_style }}" href="{{ section.settings.link }}">{{ section.settings.link_text | escape }}</a>{% endunless %}
  42. {%- endif -%}
  43. </div>
  44. </div>
  45. <div class="image-overlay image-overlay-{{ section.settings.overlay_opacity }}"></div>
  46. {% if section.settings.height == 'use_image' %}
  47. <div class="lazy-image" style="padding-top:{{ 1 | divided_by: section.settings.image.aspect_ratio | times: 100}}%; background-image: url('{{ section.settings.image | img_url: '1x1' }}');">
  48. <img class="lazyload fade-in" {% if section.settings.parallax %} style="opacity: 0;"{% endif %}
  49. alt="{{ section.settings.image.alt | default: shop.name }}"
  50. data-src="{{ img_api }}"
  51. data-widths="[180, 360, 540, 720, 900, 1080, 1296, 1512, 1728, 2048, 2450, 2700, 3000, 3350, 3750, 4100, 4480]"
  52. data-aspectratio="{{ section.settings.image.aspect_ratio }}"
  53. data-parent-fit="cover"
  54. data-sizes="auto"/>
  55. </div>
  56. {% endif %}
  57. {% if section.settings.parallax == false and section.settings.height != 'use_image' %}
  58. <div class="background-size-cover lazyload" data-bgset="{% include 'bgset', image: img_object %}"></div>
  59. {% endif %}
  60. {% if section.settings.link_text == '' and section.settings.link and section.settings.button_image == nil %}
  61. </a>
  62. {% endif %}
  63. {% if section.settings.height == 'use_screen_full' %}
  64. <div class="scroll_icon_wrap">
  65. <a href="#scroll-{{ section.id }}" class="scroll_link bloop">
  66. <span class="scroll_icon">{% include 'svg-down' %}</span>
  67. </a>
  68. </div>
  69. <div class="scroll__link" id="scroll-{{ section.id }}"></div>
  70. {% endif %}
  71. <noscript>
  72. <img src="{{ img_object | img_url: '1440x' }}" alt="{{ img_object.alt | default: section.settings.title }}" class="responsive-wide-image"/>
  73. </noscript>
  74. </div>
  75.  
  76. {% schema %}
  77. {
  78. "name": "Banner desktop",
  79. "settings": [
  80. {
  81. "type": "image_picker",
  82. "id": "image",
  83. "label": "Image"
  84. },
  85. {
  86. "type": "select",
  87. "id": "height",
  88. "label": "Section height",
  89. "default": "use_screen_two_thirds",
  90. "options": [
  91. { "value": "use_screen_full", "label": "Full screen height"},
  92. { "value": "use_screen_two_thirds", "label": "Tall"},
  93. { "value": "use_screen_one_half", "label": "Medium"},
  94. { "value": "use_screen_one_third", "label": "Short"},
  95. { "value": "use_image", "label": "Image height"}
  96. ]
  97. },
  98. {
  99. "type": "range",
  100. "id": "overlay_opacity",
  101. "min": 0,
  102. "max": 100,
  103. "step": 5,
  104. "label": "Image overlay opacity",
  105. "info": "Increase contrast for legible text.",
  106. "default": 15
  107. },
  108. {
  109. "type": "checkbox",
  110. "id": "parallax",
  111. "default": false,
  112. "label": "Enable parallax scroll"
  113. },
  114. {
  115. "type": "header",
  116. "content": "Text"
  117. },
  118. {
  119. "type": "text",
  120. "id": "title",
  121. "label": "Headline",
  122. "default": "Image with text overlay"
  123. },
  124. {
  125. "type": "textarea",
  126. "id": "description",
  127. "label": "Description",
  128. "default": "This area is used to describe your store."
  129. },
  130. {
  131. "type": "select",
  132. "id": "text_align",
  133. "label": "Alignment",
  134. "default": "text-center",
  135. "options": [
  136. { "value": "text-left", "label": "Align Left"},
  137. { "value": "text-center", "label": "Align Center"},
  138. { "value": "text-right", "label": "Align Right"}
  139. ]
  140. },
  141. {
  142. "type": "select",
  143. "id": "color",
  144. "label": "Text color",
  145. "default": "homepage--white",
  146. "options": [
  147. { "value": "homepage--white", "label": "White"},
  148. { "value": "homepage--light", "label": "Light"},
  149. { "value": "homepage--splash", "label": "Accent"},
  150. { "value": "homepage--dark", "label": "Dark"}
  151. ]
  152. },
  153. {
  154. "type": "header",
  155. "content": "Button"
  156. },
  157. {
  158. "type": "text",
  159. "id": "link_text",
  160. "label": "Text",
  161. "default": "View products",
  162. "info": "Leave blank to link entire image"
  163. },
  164. {
  165. "type": "url",
  166. "id": "link",
  167. "label": "Link"
  168. },
  169. {
  170. "type": "select",
  171. "id": "button_style",
  172. "label": "Button style",
  173. "default": "btn btn--large btn--clear btn--square uppercase",
  174. "options": [
  175. { "value": "btn btn--large btn--splash uppercase", "label": "Round"},
  176. { "value": "btn btn--large btn--splash btn--square uppercase", "label": "Square"},
  177. { "value": "btn btn--large btn--clear uppercase", "label": "Transparent round"},
  178. { "value": "btn btn--large btn--clear btn--square uppercase", "label": "Transparent square"},
  179. { "value": "btn btn--large btn--outline btn--square uppercase", "label": "Outlined square"}
  180. ]
  181. },
  182. {
  183. "type": "header",
  184. "content": "Button image (optional)"
  185. },
  186. {
  187. "type": "image_picker",
  188. "id": "button_image",
  189. "label": "Button image",
  190. "info": "1000 x 1000px .png max"
  191. }
  192. ],
  193. "presets": [
  194. {
  195. "name": "Banner desktop",
  196. "category": "Image"
  197. }
  198. ]
  199. }
  200. {% endschema %}
Add Comment
Please, Sign In to add comment