Page 1 of 1

show/hide on desktop/mobile

Posted: 29 Oct 2019, 04:55
by tony.herstell
Hi Team

I have used Sentinel and used "show on mobile/desktop" extensively to "swap in/out" sections (e.g. You Tube player window)...

Visibilities According To The Platform
ShowOnMobile Only visible on screen widths smaller than 960px.
ShowOnDesktop Only visible on screen widths bigger than 960px.

https://www.primefaces.org/eos/sentinel ... tion.xhtml

Is there something similar in Atlantis?

Re: show/hide on desktop/mobile

Posted: 30 Oct 2019, 12:07
by aragorn
Unfortunately, no! But, you can do it easily using @media queries.

Code: Select all

@media (min-width: 960px){
    /*visibilities according to the platform*/
	.ShowOnMobile{display:none; opacity:0;}
	.ShowOnDesktop{display:inherit; opacity:1;}
}
/* Portrait tablet to landscape and desktop */
@media (max-width: 959px) {
	.ShowOnMobile{display:inherit; opacity:1;}
	.ShowOnDesktop{display:none; opacity:0;}
}


Best Regards,

Re: show/hide on desktop/mobile

Posted: 30 Oct 2019, 22:32
by tony.herstell
aragorn wrote:
30 Oct 2019, 12:07
Unfortunately, no! But, you can do it easily using @media queries.

Code: Select all

@media (min-width: 960px){
    /*visibilities according to the platform*/
	.ShowOnMobile{display:none; opacity:0;}
	.ShowOnDesktop{display:inherit; opacity:1;}
}
/* Portrait tablet to landscape and desktop */
@media (max-width: 959px) {
	.ShowOnMobile{display:inherit; opacity:1;}
	.ShowOnDesktop{display:none; opacity:0;}
}


Best Regards,
Great...
But how do I use this?

I assume put the above in a .css file that gets loaded

Then how do I use this in a .xhml page?

<!-- show on mobile ->
<p:something class="ShowOnMobile">
...

<!-- show on desktop ->
<p:something class="ShowOnDesktop">
...