-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EthicalAds: Default to fixedfooter for smaller screens #447
base: main
Are you sure you want to change the base?
Changes from 4 commits
a831f71
3b7e92e
a4ef3ab
0f36172
3848033
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,6 +158,20 @@ export class EthicalAdsAddon extends AddonBase { | |
placement, | ||
elementInsertBefore.lastChild, | ||
); | ||
} else if (window.innerWidth <= 1300 && window.innerWidth > 768) { | ||
// Use fixed footer for smaller widths, but not mobile | ||
placement.setAttribute("data-ea-type", "text"); | ||
placement.setAttribute("data-ea-style", "fixedfooter"); | ||
// TODO: THIS IS A HACK. IS THERE A BETTER WAY? | ||
// Add margin to the bottom to avoid hiding bottom of content | ||
const root_node = document.querySelector(docTool.getRootSelector()); | ||
root_node.style.marginBottom = "2em"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just noting a couple issues here, I haven't tried playing around with the styling here. Altering style rules through
In both cases, it's better to use classes to apply rules to these elements. |
||
// Copy append logic from above | ||
const elementInsertBefore = document.body; | ||
elementInsertBefore.insertBefore( | ||
placement, | ||
elementInsertBefore.lastChild, | ||
); | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed this logic and the same above. These conditionals are only evaluated once, so don't catch the window resizing or rotating. Users have to reload before the placement style would shift in this case. These widths might be better off as CSS media queries, which are reactive.