Change limit() for mobile?

Hello

I’ve been using a combination of limit() and offset() to create a slider that shows groups of 4 divs. on mobile this doesn’t look so great so I was hoping to change the limit to 1 in that case. Is there a way (through kirby, php, jquery, anything) to do this?

Thanks!
Kimber

For php, you could use: https://github.com/serbanghita/Mobile-Detect

There are also JS/Jquery alternatives.

You could maybe also solve this with CSS and media queries:

@media (max-width: 600px) {
  .element:not(:first-child) {
    display: none;
  }
}

Mobile Detect worked great. Thanks so much!