When a condition is met based on the length of the variable usecase
, a CSS grid class is set using the following code:
jQuery(".uc"+useCases).addClass((landingPageData.description.useCases.length == 2) ? 'ibm-col-12-6' :
(landingPageData.description.useCases.length == 3) ? 'ibm-col-12-4' : 'ibm-col-12-3').attr('style','display:block');
Similarly, I aim to adjust the width percentage of a CSS class .ibm-columns
based on the same condition as mentioned above.
The syntax provided below is just for representation purposes and needs to be corrected:
jQuery(".ibm-columns").css((landingPageData.description.useCases.length == 2) ? 'width: 60%;' :
(landingPageData.description.useCases.length == 3) ? 'width: 70%;' : 'width: 95%;');