A space to discuss online store customization, theme development, and Liquid templating.
Hello, help please!
By following this solution:
I was able to successfully truncate EITHER the product description, or the collections description. I'm trying to do both (and later also the title). I believe the problem is on the theme.js file, at the very end of the code page I have copied this:
let read_more = document.getElementById('read-more')
let read_less = document.getElementById('read-less');
let truncated_description = document.getElementById('truncated-collection-description');
let full_description = document.getElementById('collection-description');
read_more.addEventListener('click', showHideDescription)
read_less.addEventListener('click', showHideDescription)
function showHideDescription(){
let ID = this.id
if(ID === "read-more"){
truncated_description.style.display = "none";
full_description.style.display = "block";
}else {
truncated_description.style.display = "block";
full_description.style.display = "none";
}
}
With this code, I can only write ('truncated-collection-description') OR ('truncated-product-description'), I don't know how to write both, I've tried writing ('truncated-collection-description','truncated-product-description') and ('truncated-collection-description'),('truncated-product-description'), I've also tried duplicating this code block, each block with "product" and "collection", nothing works.
Note this is on a test page, so I don't have this code live.
Thank you so much in advance if anyone knows the solution.