Is it Possible to do an if (.is-mobile) Statement in Dataview.js?

What I’m trying to do

So, I want a file to have a link that changes depending on whether I’m using a mobile device or not. Basically, something like:

if (.is-mobile) {
dv.paragraph([[mobile view]]);
}
else {
dv.paragraph([[normal view]]);
}

Is this possible?

Nevermind, figured it out! I skimmed through the Excalidraw plug-in, found the part that optimizes for mobile, and got this to work:

if (document.body.hasClass("is-mobile")) {
dv.paragraph("mobile");
}
else {
dv.paragraph("not mobile");
}

Yaaay!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.