Brands Slider Logo limit 50 logos

Brands Slider Logo limit 50 logos

proemotion
Visitor
2 0 0

Hello,

My brand logo slider is limited to 50 logos. As follow the code. How can I modify it to 100 logos or more. Thanks 

 

<style>
.parent {
display: flex;
background-color: transparent;
overflow: hidden;
width: 100%;
}

.scrolling-div {
width: fit-content;
height: fit-content;
background-color: transparent;
animation: scroll 55s linear infinite;
display: flex;
}

.scrolling-div img {
margin: 0 20px;
}

@keyframes scroll {
from {
transform: translateX(0);
}

to {
transform: translateX(-100%);

}
}
</style>

<div class="parent">
<div class="scrolling-div"></div>
</div>

<script>
// Sample array of image URLs
const imagesArray = [];
</script>

{% for block in section.blocks %}
<script>
// Get the image URL from Liquid and push it to the JavaScript array
imagesArray.push("{{ block.settings.image | image_url: width: 150 }}");
</script>
{% endfor %}

<script>

const imageWidth = 150;

const numberOfImages = imagesArray.length;

const scrollingDiv = document.querySelector('.scrolling-div');
const parentDiv = document.querySelector('.parent');

// slider function
function runSlider() {

const screenWidth = screen.width;
const totalWidth = (imageWidth) * numberOfImages;

const actualNumberOfDivsNeeded = Math.floor(screenWidth / totalWidth) + 1;

addImages();

// Function to add images to the scrolling div
function addImages() {
console.log('addImages ran');
console.log('actual number of divs needed:', actualNumberOfDivsNeeded);
for (i = 0; i < actualNumberOfDivsNeeded; i++) {
imagesArray.forEach((imageUrl, index) => {
const imgElement = document.createElement('img');
imgElement.src=imageUrl;
imgElement.alt = `Image ${index + 1}`;

scrollingDiv.appendChild(imgElement);
});
}
// duplicate scrolling divs
const clone = scrollingDiv.cloneNode(true);
parentDiv.appendChild(clone);
}
}

// Initial call to set the viewport width on page load
runSlider();
</script>

{% schema %}
{
"name": "Brand Logo Slider",
"settings": [],
"blocks": [
{
"type": "logo",
"name": "Logo",
"settings": [
{
"type": "image_picker",
"id": "image",
"label": "Logo Image"
}, {
"type": "text",
"id": "alt_text",
"label": "Alt Text"
}
]
}
],
"presets": [
{
"name": "Brand Logo Slider",
"category": "Custom"
}
],
"limit": 1
}
{% endschema %}

Replies 4 (4)

webwondersco
Shopify Partner
1164 169 170

There are a limit in section blocks you can't add more then 50. if you want to add more then you must have to use that section again on your page. this is the only way to add 100 logos

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
proemotion
Visitor
2 0 0
Hello,

Many thanks for your response.
How can I modify section blocks ?
webwondersco
Shopify Partner
1164 169 170

remove the limit attribute from the schema and try

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
Arif_Shopidevs
Shopify Partner
263 37 36

@proemotion 
It is not possilbe to add more than 50 block in the site in a secition see this screen shot from shopify doc

Arif_Shopidevs_0-1727172316160.png

You can do by add extra image and content in each block to solve your issues.

Arif_Shopidevs_1-1727172378565.png

here is the update code

 

<style>
.parent {
display: flex;
background-color: transparent;
overflow: hidden;
width: 100%;
}

.scrolling-div {
width: fit-content;
height: fit-content;
background-color: transparent;
animation: scroll 55s linear infinite;
display: flex;
}

.scrolling-div img {
margin: 0 20px;
}

@keyframes scroll {
from {
transform: translateX(0);
}

to {
transform: translateX(-100%);

}
}
</style>

<div class="parent">
<div class="scrolling-div"></div>
</div>

<script>
// Sample array of image URLs
const imagesArray = [];
</script>

{% for block in section.blocks %}
<script>
// Get the image URL from Liquid and push it to the JavaScript array
imagesArray.push("{{ block.settings.image | image_url: width: 150 }}");
imagesArray.push("{{ block.settings.image_second | image_url: width: 150 }}");
</script>
{% endfor %}

<script>

const imageWidth = 150;

const numberOfImages = imagesArray.length;

const scrollingDiv = document.querySelector('.scrolling-div');
const parentDiv = document.querySelector('.parent');

// slider function
function runSlider() {

const screenWidth = screen.width;
const totalWidth = (imageWidth) * numberOfImages;

const actualNumberOfDivsNeeded = Math.floor(screenWidth / totalWidth) + 1;

addImages();

// Function to add images to the scrolling div
function addImages() {
console.log('addImages ran');
console.log('actual number of divs needed:', actualNumberOfDivsNeeded);
for (i = 0; i < actualNumberOfDivsNeeded; i++) {
imagesArray.forEach((imageUrl, index) => {
const imgElement = document.createElement('img');
imgElement.src=imageUrl;
imgElement.alt = `Image ${index + 1}`;

scrollingDiv.appendChild(imgElement);
});
}
// duplicate scrolling divs
const clone = scrollingDiv.cloneNode(true);
parentDiv.appendChild(clone);
}
}

// Initial call to set the viewport width on page load
runSlider();
</script>

{% schema %}
{
"name": "Brand Logo Slider",
"settings": [],
"blocks": [
{
"type": "logo",
"name": "Logo",
"settings": [
{
"type": "image_picker",
"id": "image",
"label": "Logo Image"
}, {
"type": "text",
"id": "alt_text",
"label": "Alt Text"
},
  {
"type": "image_picker",
"id": "image_second",
"label": "Logo Image Second"
}, {
"type": "text",
"id": "alt_text_second",
"label": "Alt Text Second"
}
]
}
],
"presets": [
{
"name": "Brand Logo Slider",
"category": "Custom"
}
],
"limit": 1
}
{% endschema %}

 

Hope this will solve your issues.

Found it helpful? Please like and mark the solution that helped you

 

 

Found it helpful? Please like and mark the solution that helped you.
Slider Revolution - Create sliders, theme sections, banners, videos, pages, advanced animation, and social feeds.
Essential Grid Gallery - Create photo galleries, video galleries, portfolio galleries, product gallery, collection gallery and more.
EasyDisplay: Product Showcase - Easily display collections, related products, discounts, recently viewed items, and best sellers