Theme.js: How to truncate Collection and Product descriptions AND titles on the same page (Venture)

22 0 5

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 =
  if(ID === "read-more"){ = "none"; = "block";
  }else { = "block"; = "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.

Replies 0 (0)