Source Code - Shopify Testimonial Widget | Web Scripts | Crax

Welcome To Crax.Pro Forum!

Check our new Marketplace at Crax.Shop

   Login! SignUp Now!
  • We are in solidarity with our brothers and sisters in Palestine. Free Palestine. To learn more visit this Page

Source Code Shopify Testimonial Widget

Source Code Shopify Testimonial Widget

LV
0
 

alexias42

Member
Joined
Jun 26, 2024
Threads
5
Likes
0
Awards
1
Credits
268©
Cash
0$

Step-by-Step Guide​

Step 1: Create a New Section in Shopify​

  1. Go to your Shopify admin panel.
  2. Navigate to Online Store -> Themes.
  3. Click Actions -> Edit Code.
  4. In the Sections directory, click Add a new section.
  5. Name your new section horizontal-ticker and create a file named horizontal-ticker.liquid.

Step 2: Add HTML Structure and Liquid Code​

In the horizontal-ticker.liquid file, add the following HTML structure and Liquid code:

liquid
Copy code
<!-- horizontal-ticker.liquid -->

<div class="horizontal-ticker-container">
<div class="ticker-wrapper">
<ul class="ticker">
{% for item in section.settings.ticker_items %}
<li class="ticker-item">{{ item }}</li>
{% endfor %}
</ul>
</div>
</div>

<style>
.horizontal-ticker-container {
width: 100%;
overflow: hidden;
background-color: #f0f0f0; /* Adjust background color */
}

.ticker-wrapper {
display: inline-block;
white-space: nowrap;
animation: ticker-scroll 30s linear infinite;
}

.ticker {
list-style-type: none;
padding: 0;
margin: 0;
}

.ticker-item {
display: inline-block;
padding: 0 20px; /* Adjust padding as needed */
line-height: 40px; /* Adjust line height as needed */
}

@keyframes ticker-scroll {
0% {
transform: translateX(100%);
}
100% {
transform: translateX(-100%);
}
}
</style>

Step 3: Configure Section Settings​

To allow easy management of ticker items from the Shopify admin, add the following JSON schema to your horizontal-ticker.liquid file:

liquid
Copy code
{% schema %}
{
"name": "Horizontal Ticker",
"settings": [
{
"type": "text",
"id": "title",
"label": "Widget Title",
"default": "Ticker"
},
{
"type": "textarea",
"id": "ticker_items",
"label": "Ticker Items",
"info": "Enter each ticker item on a new line",
"default": "Item 1\nItem 2\nItem 3"
}
]
}
{% endschema %}

Step 4: Include JavaScript (Optional)​

If you want to customize the behavior or speed of the ticker, add JavaScript to control the animation:

liquid
Copy code
<script>
document.addEventListener('DOMContentLoaded', function() {
// Calculate animation duration based on content width
let tickerWrapper = document.querySelector('.ticker-wrapper');
let contentWidth = tickerWrapper.scrollWidth;
let animationDuration = contentWidth / 50; // Adjust speed as needed (smaller number = faster)

tickerWrapper.style.animationDuration = animationDuration + 's';
});
</script>

Step 5: Include the Section in Your Theme​

Finally, include your new section in the appropriate place within your Shopify theme:

liquid
Copy code
{% section 'horizontal-ticker' %}
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Tips
Tips
Top Bottom