Showing different 'view' in page on mobile device

I’ve learned enough about Knack now (just about!) to create the look I would like to embed in a Squarespace webpage - and I can do this for either a pc browser or a mobile device.

But what I don’t know is if it is possible to call a different ‘view’ (from the Knack ‘add view’ option) automatically if it is being viewed on a phone or tablet.

Is this possible, and if so could someone explain how it might be achieved?

Hi @Richard13! Welcome to the Knack community :wave:

Great question! I’ve moved your topic to the API Customization > Ask Developers category because it seems as though you may need some custom code implementation to achieve this.

If you don’t find the answer you’re looking for here, please check out our Expert Network, which has our experienced Knack Builders and Knack developers: Expert Network

You could create multiple version of views on the same page and use some custom code to hide the views depending on if you are on a mobile or desktop. For example to hide view_xxx on mobile:

/* Hide Desktop Views of Tasks on Mobile  */
@media screen and (max-width: 499px) {
  div#view_44, div#view_81, div#view_48, div#view_99  {
  display: none;
  }

Or hide views on desktop:

/* Hide Mobile Views of Tasks on Desktop */
@media screen and (min-width: 499px) {
  div#view_100 {
  display: none;
  }

}
1 Like