How to use seperate viewtoolbar buttons with similar functions for mobile and desktop without using any mobile centric themes like JD’s or notebook theme.
Suppose I have two similar viewtoolbar buttons (one for mobile mode and other one for desktop use) to invoke a modal which contain data related to current tiddler. In the button for use in mobile, I have reduced some contents which will overflow beyond the margin of the phone display. I want to display only one of buttons in either of the modes (mobile and desktop). Is there any filter which I can use to show the button only in mobile/desktop modes.
You can get a screen height/widge using the InfoMechanism or install the core plugin “Browser Sniff” to get more information about the browser.
- Once you choose the test to determin when to use which button, inside each button tiddler wrap the button in a list widget so it shows or hides its content one when needed.
I am starting a new thread here to get more general solution for limiting the number of viewtoolbar buttons in mobile usage . I tried using the browser Sniff plug in, but I got stuck at one point. That’s when I thought a more general solution would be better.
Before we end this thread I just though rather than test for mobile use which you can do, consider instead testing for portrait vs landscape comparing the values in
- $:/info/browser/screen/width Screen width in pixels
- $:/info/browser/screen/height Screen height in pixels
For example the smaller of the two ?