isDeviceOrientationPortrait()
Function Documentation¶
Overview¶
The isDeviceOrientationPortrait()
function is a utility function used in Merciglobal Cloud ERP front-end modules to detect if a user's device is currently in portrait mode. This can be crucial for responsive designs, especially when tailoring user experience for mobile or tablet users.
Purpose¶
To dynamically adjust layouts, controls, or behaviors depending on the orientation of the device.
Use Cases¶
- Adjust UI layout for mobile devices.
- Trigger warnings or prompts when the orientation is not supported.
- Dynamically switch stylesheets or class names for responsive designs.
- Tailor navigation experiences on smaller screens.
Example Usage¶
if (isDeviceOrientationPortrait()) {
console.log("You're in portrait mode!");
document.body.classList.add('portrait-mode');
} else {
console.log("You're in landscape mode!");
document.body.classList.add('landscape-mode');
}
Implementation in Merciglobal Cloud ERP¶
In Merciglobal Cloud ERP, this function is used in: - POS modules for layout switching. - Mobile dashboards for responsive chart rendering. - Onboarding wizards to recommend orientation.
Considerations¶
- Some older browsers may not support
window.matchMedia()
. - Ensure event listeners for
orientationchange
orresize
are managed properly to reflect live orientation changes.
Orientation-Specific Pricing (Example for Mobile UI Modules)¶
Module | Portrait Price (USD) | Landscape Price (USD) |
---|---|---|
POS Lite Mobile UI | $15/month | $20/month |
Advanced Dashboard Views | $25/month | $30/month |
Onboarding Animations | $10/month | $12/month |
Tips for Developers¶
- Combine this check with
resize
ororientationchange
events:window.addEventListener("resize", () => { if (isDeviceOrientationPortrait()) { // Adjust UI } });
- Always provide a fallback layout.
Used by: Merciglobal Cloud ERP Front-End & Mobile Modules
Audience: Internal Developers, Sales Team (for demo use), Customers using responsive modules