- This Shopify Liquid code creates a fully customizable shopify banner slider with smooth fade/pull/slide transitions, mobile-responsive design, and autoplay/navigation controls for engaging product displays.
- It allows separate desktop/mobile images, customizable buttons with links, and three transition effects to showcase content beautifully across devices.
- Need help implementing this? Contact a Shopify developer for professional customization and integration services to make it work perfectly for your store.
Shopify Schema Code
{% schema %}
{
"name": "Advanced Banner Slider",
"settings": [
{
"type": "checkbox",
"id": "show_arrows",
"label": "Show Navigation Arrows",
"default": true
},
{
"type": "checkbox",
"id": "show_dots",
"label": "Show Pagination Dots",
"default": true
},
{
"type": "checkbox",
"id": "autoplay",
"label": "Enable Autoplay",
"default": true
},
{
"type": "range",
"id": "autoplay_speed",
"label": "Autoplay Speed (seconds)",
"min": 2,
"max": 10,
"step": 1,
"default": 5
},
{
"type": "range",
"id": "slide_height_desktop",
"label": "Slide Height (Desktop)",
"min": 300,
"max": 800,
"step": 10,
"default": 500,
"unit": "px"
},
{
"type": "range",
"id": "slide_height_mobile",
"label": "Slide Height (Mobile)",
"min": 200,
"max": 600,
"step": 10,
"default": 300,
"unit": "px"
},
{
"type": "select",
"id": "transition_effect",
"label": "Transition Effect",
"options": [
{
"value": "fade",
"label": "Fade"
},
{
"value": "pull",
"label": "Pull"
},
{
"value": "slide",
"label": "Slide"
}
],
"default": "fade"
},
{
"type": "range",
"id": "transition_duration",
"label": "Transition Duration (ms)",
"min": 300,
"max": 1000,
"step": 100,
"default": 600,
"unit": "ms"
}
],
"blocks": [
{
"type": "slide",
"name": "Slide",
"settings": [
{
"type": "image_picker",
"id": "image_desktop",
"label": "Desktop Image",
"info": "Recommended size: 1800x800px"
},
{
"type": "image_picker",
"id": "image_mobile",
"label": "Mobile Image",
"info": "Recommended size: 800x1000px"
},
{
"type": "text",
"id": "heading",
"label": "Heading",
"default": "Slide Heading"
},
{
"type": "richtext",
"id": "text",
"label": "Text",
"default": "Slide description text goes here
"
},
{
"type": "text",
"id": "button_text",
"label": "Button Text",
"default": "Shop Now"
},
{
"type": "url",
"id": "button_link",
"label": "Button Link"
},
{
"type": "color",
"id": "text_color",
"label": "Text Color",
"default": "#ffffff"
},
{
"type": "select",
"id": "text_alignment",
"label": "Text Alignment",
"options": [
{
"value": "left",
"label": "Left"
},
{
"value": "center",
"label": "Center"
},
{
"value": "right",
"label": "Right"
}
],
"default": "center"
},
{
"type": "color",
"id": "button_bg_color",
"label": "Button Background Color",
"default": "#000000"
},
{
"type": "color",
"id": "button_text_color",
"label": "Button Text Color",
"default": "#ffffff"
}
]
}
],
"presets": [
{
"name": "Advanced Banner Slider",
"category": "Image",
"blocks": [
{
"type": "slide"
},
{
"type": "slide"
}
]
}
]
}
{% endschema %}
Shopify Liquid Code
{% for block in section.blocks %}
{% if block.settings.image_desktop != blank %}
{% endif %}
{% if block.settings.heading != blank %}
{{ block.settings.heading }}
{% endif %}
{% if block.settings.text != blank %}
{{ block.settings.text }}
{% endif %}
{% if block.settings.button_text != blank and block.settings.button_link != blank %}
{{ block.settings.button_text }}
{% endif %}
{% endfor %}
{% if section.blocks.size > 1 %}
{% if section.settings.show_arrows %}
{% endif %}
{% if section.settings.show_dots %}
{% for block in section.blocks %}
{% endfor %}
{% endif %}
{% endif %}
CSS Code
{% style %}
.banner-slider {
position: relative;
width: 100%;
margin: 0 auto;
overflow: hidden;
}
.banner-slider__slides-container {
position: relative;
width: 100%;
height: {{ section.settings.slide_height_desktop }}px;
}
/* Fade Transition */
.banner-slider[data-transition="fade"] .banner-slider__slide {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
transition: opacity {{ section.settings.transition_duration }}ms ease-in-out;
z-index: 1;
}
.banner-slider[data-transition="fade"] .banner-slider__slide--active {
opacity: 1;
z-index: 2;
}
/* Pull Transition */
.banner-slider[data-transition="pull"] .banner-slider__slides-container {
overflow: hidden;
}
.banner-slider[data-transition="pull"] .banner-slider__slide {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transition: transform {{ section.settings.transition_duration }}ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
z-index: 1;
}
.banner-slider[data-transition="pull"] .banner-slider__slide--next {
transform: translateX(100%);
}
.banner-slider[data-transition="pull"] .banner-slider__slide--prev {
transform: translateX(-100%);
}
.banner-slider[data-transition="pull"] .banner-slider__slide--active {
transform: translateX(0);
z-index: 2;
}
/* Slide Transition */
.banner-slider[data-transition="slide"] .banner-slider__slides-container {
display: flex;
transition: transform {{ section.settings.transition_duration }}ms ease-in-out;
}
.banner-slider[data-transition="slide"] .banner-slider__slide {
min-width: 100%;
height: 100%;
}
/* Common Slide Styles */
.banner-slider__content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: {{ block.settings.text_alignment }};
padding: 2rem;
z-index: 2;
color: {{ block.settings.text_color }};
text-align: {{ block.settings.text_alignment }};
}
.banner-slider__heading {
font-size: 2.5rem;
margin-bottom: 1rem;
color: inherit;
}
.banner-slider__text {
font-size: 1.2rem;
margin-bottom: 1.5rem;
max-width: 600px;
color: inherit;
}
.banner-slider__button {
display: inline-block;
padding: 0.75rem 1.5rem;
background-color: {{ block.settings.button_bg_color }};
color: {{ block.settings.button_text_color }};
text-decoration: none;
border-radius: 4px;
font-weight: bold;
transition: opacity 0.3s ease;
}
.banner-slider__button:hover {
opacity: 0.9;
}
.banner-slider__image {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
z-index: 1;
}
/* Navigation Arrows */
.banner-slider__arrow {
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 40px;
height: 40px;
background-color: rgba(255,255,255,0.5);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: 3;
border: none;
}
.banner-slider__arrow--prev {
left: 20px;
}
.banner-slider__arrow--next {
right: 20px;
}
/* Pagination Dots */
.banner-slider__dots {
position: absolute;
bottom: 20px;
left: 0;
right: 0;
display: flex;
justify-content: center;
z-index: 3;
}
.banner-slider__dot {
width: 12px;
height: 12px;
border-radius: 50%;
background-color: rgba(255,255,255,0.5);
margin: 0 5px;
cursor: pointer;
border: none;
padding: 0;
transition: background-color 0.3s ease;
}
.banner-slider__dot--active {
background-color: #fff;
}
/* Mobile Styles */
@media screen and (max-width: 767px) {
.banner-slider__slides-container,
.banner-slider__slide {
height: {{ section.settings.slide_height_mobile }}px;
}
.banner-slider__heading {
font-size: 1.8rem;
}
.banner-slider__text {
font-size: 1rem;
}
.banner-slider__dot {
width: 10px;
height: 10px;
}
}
{% endstyle %}
Java Script Code
Key Features:
Multiple Transition Effects:
Fade (smooth opacity transition)
Pull (sliding effect with momentum)
Slide (traditional horizontal slide)
Enhanced Settings:
Transition effect selection
Adjustable transition duration
All previous settings maintained
Smooth Animations:
CSS transitions with custom timing
Bezier curves for natural movement
No jerky movements
Improved Performance:
Transition state management
No overlapping animations
Clean JavaScript implementation
Fully Responsive:
Works on all devices
Mobile-specific optimizations
With 7+ years of experience in Shopify development, eCommerce solutions, and SEO, I have successfully delivered 100+ high-performing Shopify stores that drive conversions and enhance user experience.
Latest posts by Shahrukh Miya (see all)
- How To Add Before And After Slider To Shopify? - April 12, 2025
- How to add a Table of Contents for your Blog Posts Using Shopify - April 10, 2025
- How to Add Custom Image with Text section in Shopify (Step-by-Step Guide) - April 10, 2025