I need to value a variable based on the width of the window.
The line to value is this
{% assign value = column_number | divided_by: value %}
based on window it is greater than 991 the value variable must take on
4.0 or 3.0
I tried with javascript
<script> if(window.innerWidth < 991 ) {
console.log(3);
document.write("{% assign value = column_number | divided_by: 3.0 %}");
}
else
{
console.log(4);
document.write("{% assign value = column_number | divided_by: 4.0 %}");
}
console.log(window.innerWidth);
</script>
valore {{ value }}
but nothing. the value {{ value }} is not valued
If I tighten or widen the window the change is noticed and the console log also works, but the variable is not displayed in liquid