<horizontal>
<!-- Content for horizontal screen orientation -->
</horizontal>
<vertical>
<!-- Content for vertical screen orientation -->
</vertical>
<mobile>
<!-- Content for mobile -->
</mobile>
<desktop>
<!-- Content for desktop -->
</desktop>
In addition to the tags, you can use the constant booleans
isMobile
andisDesktop
. I think those are fairly self-explanatory.
The "horizontal" and "vertical" conditions are updated on window resize.
The "mobile" and "desktop" conditions are only checked upon load of the library.
Tags are hidden using cssdisplay: none
and unhidden usingdisplay: block
.
The library is tiny and can be easily modified to fit your needs.