Hi.
How can I execute a js script depending on the screen size?
It would be something like this:
{% block javascripts %}
<script>
var width = {# sample code #}
{% if screen < 980 %}
{# javascript code #}
{% endif %}
</script>
{% endblock %}
I've tested with
var w = window.innerWidth
if w < 980 {
{# code #}
}
but no resuts.
I don't know if this can be done directly in the Twig templates. Anyone who can help?