Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. <div class="col-xs-12 col-sm-6 product-img-box {% if settings.product_image_border%} grid-item-border {% endif %}">
  2. {% if product.images.size == 0 %}
  3. <div class="product-photo-container" style="padding: 30px">
  4. <img src="{{ '' | product_img_url: 'grande' }}" alt="">
  5. </div>
  6. {% else %}
  7. <div class="product-photo-container" style="padding: 30px">
  8. {% assign featured_image = product.selected_or_first_available_variant.featured_image | default: product.featured_image %}
  9. <a href="{{ featured_image | img_url: 'original' }}" >
  10. <img id="product-featured-image" src="{{ featured_image | img_url: 'grande' }}" alt="{{ featured_image.alt | escape }}" data-zoom-image="{{ featured_image.src | img_url: 'original' }}"/>
  11. </a>
  12. </div>
  13. {% if product.images.size > 1 %}
  14. <div class="more-view-wrapper ">
  15. <ul id="more-view-carousel" class="product-photo-thumbs row">
  16. {% for image in product.images %}
  17. <li class="grid-item col-xs-4 col-sm-3">
  18. <a href="javascript:void(0)" data-image="{{ image.src | product_img_url: 'grande' }}" data-zoom-image="{{ image.src | product_img_url: 'original' }}">
  19. <img src="{{ image.src | product_img_url: 'compact' }}" alt="{{ image.alt | escape }}">
  20. </a>
  21. </li>
  22. {% endfor %}
  23. </ul>
  24. </div>
  25. {% endif %}
  26. {% endif %}
  27. </div>
  28.  
  29. {% comment %} Please at the bottom of product.liquid {% endcomment %}
  30.  
  31. {% assign option_name = 'Color' %}
  32. {% if product.options contains option_name %}
  33.  
  34. <script>
  35. // Grabbing product thumbnails
  36. // Covers: Editions, Launchpad Star, Lookbook, Kickstand, Startup, Simple, Radiance, Minimal, Supply, New Standard and many more.
  37. var thumbnails = jQuery('img[src*="/products/"]') /* All product images */
  38. .not('#related-products img') /* Except related products, thumbnails not clickable */
  39. .not('a[href^="/collections/"] img') /* Except related products */
  40. .not('a[href^="/products/"] img') /* Except mini-cart products */
  41. .not('header img') /* Except mini-cart products, thumbnails not clickable */
  42. .not('#drawer img') /* Except mini-cart products, thumbnails not clickable, in Simple theme. */
  43. .not(':first'); /* Except first one, i.e the main image */
  44.  
  45. var optionSelect;
  46. {% assign option_index = 0 %}
  47. {% for option in product.options %}
  48. {% if option == option_name %}
  49. {% assign option_index = forloop.index0 %}
  50. {% endif %}
  51. {% endfor %}
  52.  
  53. {% if product.options.size == 1 %}
  54. optionSelect = '.single-option-selector';
  55. {% else %}
  56. optionSelect = 'label:contains({{ option_name }}) + .single-option-selector';
  57. {% endif %}
  58.  
  59. jQuery('form[action="/cart/add"]').on('change', optionSelect, function() {
  60. var optionValue = $(this).val();
  61. thumbnails.each(function() {
  62. var wrapper = $(this);
  63. while ( wrapper.parent().children().length === 1 ) {
  64. wrapper = wrapper.parent();
  65. }
  66. if ( jQuery(this).attr('alt') === optionValue ) {
  67. wrapper.show();
  68. }
  69. else {
  70. wrapper.hide();
  71. }
  72. });
  73. });
  74. </script>
  75.  
  76. {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement