Web: Common: PageLayout: Fixed Article pin on mobile
This commit is contained in:
parent
61fceef6db
commit
0e8adf3066
@ -33,9 +33,13 @@ class PageLayoutComponent extends React.PureComponent {
|
||||
}
|
||||
|
||||
orientationChangeHandler = () => {
|
||||
const isOrientationVertical = !(screen.orientation.angle % 180);
|
||||
const articleElement = document.getElementsByTagName('article')[0];
|
||||
|
||||
if (!articleElement) return;
|
||||
|
||||
const isOrientationVertical = !(screen.orientation ? screen.orientation.angle % 180 : window.matchMedia("(orientation: portrait)"));
|
||||
const isValueExist = !!localStorage.getItem(ARTICLE_PINNED_KEY);
|
||||
const articleWidth = document.getElementsByTagName('article')[0].offsetWidth;
|
||||
const articleWidth = articleElement.offsetWidth;
|
||||
const isArticleWide = articleWidth > screen.availWidth - articleWidth;
|
||||
|
||||
if (isOrientationVertical && isArticleWide && isValueExist) {
|
||||
|
Loading…
Reference in New Issue
Block a user