ADD SLICKSLIDER FOR PRODUCT IMAGE
-----------------------------------------------------------------------------------------------------------------------------------------------
ADD SLICKSLIDER FOR PRODUCT IMAGE FROM CODE PEN CODE
READ MORE:
ADD SLICK SLIDER FOR SHOPIFY PRODUCT
https://www.csscodelab.com/vue-slick-slider-design-example/
https://codepen.io/vilcu/full/ZQwdGQ
SLICK SLIDER SOURCE FILES:
https://shopifyjs.blogspot.com/2021/04/slick-slider-source-files.html
-----------------------------------------------------------------------------------------------------------------------------------------------
<html lang="en" ><head><title>CodePen - Slick slider</title><style>.slick-dots {/* position: absolute; bottom: -3.5rem; */ display: block; padding: 0; margin: 0; list-style: none; line-height: 0;}.slick-dots li {position: relative; display: inline-block; width: 0.9375rem; height: 0.9375rem; margin: 0 0.875rem; padding: 0; cursor: pointer;}.slick-dots li:first-child {margin-left: 0;}.slick-dots li:last-child {margin-right: 0;}.slick-dots li button {font-size: 0; line-height: 0; display: block; width: 0.9375rem; height: 0.9375rem; padding: 0.3125rem; cursor: pointer; color: transparent; outline: none; border:none; background: rgba(47, 31, 22, 0.5); border-radius: 50%;}.slick-dots li button:hover,.slick-dots li button:focus,.slick-dots li.slick-active button {outline: none; background-color: #2d1d15; transition: all 300ms ease 0s; color: #2d1d15;}</style><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.0/slick.min.css" /><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.0/slick-theme.min.css" /><script src="https://code.jquery.com/jquery-3.2.1.min.js"></script><script src='https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick.min.js'>It increase image size</script></head><body translate="no" ><div class="slider">{% for image in product.images %}<!-- WE USE FOR LOOP LINE BEFORE DIV TAG AND IMAGEBECAUSE DIV AND IMAGE LINE REPEAT IN HTML SLIDER --><div class="p-5 mx-3 bg-light"><img src="{{image|img_url:'1200x' }}"/></div>{% endfor %}</div><script id="rendered-js" >$('.slider').slick({dots: true });//# sourceURL=pen.js</script></body></html>
---------------------------------------------------------------------------------------------------------------------------ADD SLICKSLIDER FOR PRODUCT IMAGE FROM CODE PEN CODE---------------------------------------------------------------------------------------------------------------------------------------------
<html><head><link rel="stylesheet" type="text/css" href="https://kenwheeler.github.io/slick/slick/slick.css" /><link rel="stylesheet" type="text/css" href="https://kenwheeler.github.io/slick/slick/slick-theme.css" /></head><body><div class="slider single-item">{% for image in product.images %} <img src="{{image|img_url:'1200x' }}"/> {% endfor %} </div><script src="https://code.jquery.com/jquery-1.11.0.min.js"></script><script type="text/javascript" src="https://kenwheeler.github.io/slick/slick/slick.js"></script><script type="text/javascript"> //https://kenwheeler.github.io/slick/js/scripts.js$(document).ready(function() {$('.single-item').slick({dots: true,infinite: true,speed: 500,slidesToShow: 1,slidesToScroll: 1});})</script></body></html>------------------------------------------------------------------------------------------------------------------------ADD SLICKSLIDER FOR PRODUCT IMAGE FROM CODE PEN CODEREAD MORE:https://codepen.io/vilcu/pen/gXNZyV https://codepen.io/vilcu/full/ZQwdGQCODE AFTER ASSIGN FEATURE IMAGE-----------------------------------------------------------------------------------------------------------------------------------------{%- assign featured_image = product.selected_or_first_available_variant.featured_image | default: product.featured_image -%}
<div class="main"><div class="slider slider-for">{% for image in product.images %} <img src="{{image|img_url:'1200x' }}"/> {% endfor %} </div><div class="slider slider-nav">{% for image in product.images %} <img src="{{image|img_url:'600x' }}"/> {% endfor %} </div><div class="action"><a href="#" data-slide="3">go to slide 3</a><a href="#" data-slide="4">go to slide 4</a><a href="#" data-slide="5">go to slide 5</a></div></div><script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script><script src='https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.js'></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"><link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.css'><link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick-theme.min.css'><script id="rendered-js" >$('.slider-for').slick({slidesToShow: 1,slidesToScroll: 1,arrows: true,fade: true,asNavFor: '.slider-nav' });$('.slider-nav').slick({slidesToShow: 3,slidesToScroll: 1,asNavFor: '.slider-for',dots: true,focusOnSelect: true });$('a[data-slide]').click(function (e) {e.preventDefault();var slideno = $(this).data('slide');$('.slider-nav').slick('slickGoTo', slideno - 1);});//# sourceURL=pen.js</script><style>body{background:#ccc;}.main {font-family:Arial;width:500px;display:block;margin:0 auto;}h3 {background: #fff;color: #3498db;font-size: 36px;line-height: 100px;margin: 10px;padding: 2%;position: relative;text-align: center;}.action{display:block;margin:100px auto;width:100%;text-align:center;}.action a {display:inline-block;padding:5px 10px; background:#f30;color:#fff;text-decoration:none;}.action a:hover{background:#000;}</style>
<noscript>
--------------------------------------------------------------------------------------------------------------------ADD SLICKSLIDER FOR PRODUCT IMAGE FROM SHOPIFY DEBUT SLIDER CODE--------------------------------------------------------------------------------------------------------------------<div data-section-id="{{ section.id }}" data-section-type="slideshow-section"><div id="SlideshowWrapper-{{ section.id }}" class="slideshow-wrapper"><div class="slideshow slideshow--"id="Slideshow-{{ section.id }}"data-slide-nav-a11y="">{% for image in product.images %}<img class="box ratio-container lazyload"src="auto"style="background-image: url('{{image|img_url:'1200x' }}');"/>{% endfor %} </div><div class="slideshow__controls"><div class="slideshow__arrows"style="width:169px"><button class="slideshow__arrow slideshow__arrow-left" aria-label="Previous slide"><svg aria-hidden="true" focusable="false" role="presentation" class="icon icon-chevron-left" viewBox="0 0 7 11"><path d="M5.5.037a1.5 1.5 0 0 1 1.06 2.56l-2.94 2.94 2.94 2.94a1.5 1.5 0 0 1-2.12 2.12l-4-4a1.5 1.5 0 0 1 0-2.12l4-4A1.5 1.5 0 0 1 5.5.037z" fill="#fff" class="layer"/></svg></button><button class="slideshow__arrow slideshow__arrow-right" aria-label="Next slide"><svg aria-hidden="true" focusable="false" role="presentation" class="icon icon-chevron-right" viewBox="0 0 7 11"><path d="M1.5 11A1.5 1.5 0 0 1 .44 8.44L3.38 5.5.44 2.56A1.5 1.5 0 0 1 2.56.44l4 4a1.5 1.5 0 0 1 0 2.12l-4 4A1.5 1.5 0 0 1 1.5 11z" fill="#fff"/></svg></button></div></div></div></div>
------------------------------------------------------------------------------------------------------------W3 SLIDER CODEhttps://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_slideshow<!-- WE USE FOR LOOP BEFORE <div class="mySlides fade">BECAUSE IT REPEATS IN SLIDER -->{% for image in product.images %} <div class="mySlides fade">------------------------------------------------------------------------------------------------------------<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {box-sizing: border-box}
body {font-family: Verdana, sans-serif; margin:0}
.mySlides {display: none}
img {vertical-align: middle;}
/* Slideshow container */
.slideshow-container {
max-width: 1000px;
position: relative;
margin: auto;
}
/* Next & previous buttons */
.prev, .next {
cursor: pointer;
position: absolute;
top: 50%;
width: auto;
padding: 16px;
margin-top: -22px;
color: white;
font-weight: bold;
font-size: 18px;
transition: 0.6s ease;
border-radius: 0 3px 3px 0;
user-select: none;
}
/* Position the "next button" to the right */
.next {
right: 0;
border-radius: 3px 0 0 3px;
}
/* On hover, add a black background color with a little bit see-through */
.prev:hover, .next:hover {
background-color: rgba(0,0,0,0.8);
}
/* Caption text */
.text {
color: #f2f2f2;
font-size: 15px;
padding: 8px 12px;
position: absolute;
bottom: 8px;
width: 100%;
text-align: center;
}
/* Number text (1/3 etc) */
.numbertext {
color: #f2f2f2;
font-size: 12px;
padding: 8px 12px;
position: absolute;
top: 0;
}
/* The dots/bullets/indicators */
.dot {
cursor: pointer;
height: 15px;
width: 15px;
margin: 0 2px;
background-color: #bbb;
border-radius: 50%;
display: inline-block;
transition: background-color 0.6s ease;
}
.active, .dot:hover {
background-color: #717171;
}
</style>
</head>
<body>
<div class="slideshow-container">
<!-- WE USE FOR LOOP BEFORE <div class="mySlides fade"> BECAUSE IT REPEATS IN SLIDER -->
{% for image in product.images %}
<div class="mySlides fade">
<img src="{{image | product_img_url: 'large' }}" alt="{{ product.title | escape }}" />
</div>
{% endfor %}
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a>
</div>
<br>
<div style="text-align:center">
<span class="dot" onclick="currentSlide(1)"></span>
<span class="dot" onclick="currentSlide(2)"></span>
<span class="dot" onclick="currentSlide(3)"></span>
</div>
<script>
var slideIndex = 1;
showSlides(slideIndex);
function plusSlides(n) {
showSlides(slideIndex += n);
}
function currentSlide(n) {
showSlides(slideIndex = n);
}
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("dot");
if (n > slides.length) {slideIndex = 1}
if (n < 1) {slideIndex = slides.length}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " active";
}
</script>
</body>
</html>
-----------------------------------------------------------------------------------------------------------CSS SLIDER IN SHOPIFY-----------------------------------------------------------------------------------------------------------<html>
<head>
<style>
@keyframes slidy {
0% { left: 0%; }
20% { left: 0%; }
25% { left: -100%; }
45% { left: -100%; }
50% { left: -200%; }
70% { left: -200%; }
75% { left: -300%; }
95% { left: -300%; }
100% { left: -400%; }
}
body { margin: 0; }
div#slider { overflow: hidden; }
div#slider figure img { width: 20%; float: left; }
div#slider figure {
position: relative;
width: 500%;
margin: 0;
left: 0;
text-align: left;
font-size: 0;
animation: 30s slidy infinite;
}
</style>
</head>
<body>
<div id="slider">
<figure>
{% for image in product.images %}
<img src="{{image|img_url:'large'}}"/>
{% endfor %}
</figure>
</div>
</body>
</html>
------------------------------------------------------------------------------------------------------------------Here’s the list of sizes with their corresponding image names:
16 × 16
pico
32 × 32
icon
50 × 50
thumb
100 × 100
small
160 × 160
compact
240 × 240
medium
480 × 480
large
600 × 600
grande
1024 × 1024
1024x1024
2048 × 2048
2048x2048
Largest image
master

Comments
Post a Comment