Utilizing bootstrap 4, my code is executing a for loop to generate eight divs with the class "item".
To display five items per row, I am using the class "col-2". However, this results in six items being shown in a single row.
Since I cannot include the offset directly in the markup due to the loop, I am using JavaScript to add it.
In order to only apply this JavaScript at a minimum width of 1440px, I've added the following code snippet:
$('.item:nth-child(5n+1)').addClass('offset-1');
Is there a way to ensure this JavaScript only runs when the viewport is at a width of 1440px or larger?