Javascript add if width screen
-
Hello,
I use the following javascript code to make it that my products page shows 4 products in a row instead of 3:
add_filter('loop_shop_columns', 'loop_columns'); if (!function_exists('loop_columns')) { function loop_columns() { return 3; // 3 products per row } }
This code works well.
However, I only want this to happen when screen width is 1345px or larger. If smaller I just want it to be the standard 3 products per row.I’ve searched and tried different codes, but each time my website becomes blank.
I found this:
if ( $(window).width() > 1345) { //Add your javascript for large screens here } else { //Add your javascript for small screens here }
But how to integrate this code into the first code?
Thanks!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Javascript add if width screen’ is closed to new replies.