Skip to content

Commit

Permalink
fix: hide sticky ads on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirko Nowak committed Feb 24, 2024
1 parent a38244d commit c8ad926
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/shared/components/ads/ads.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
attr.data-ea-keywords="{{ keywords }}"
id="fixedfooter"
></div>
<div *ngIf="sticky && !manuallyClosed" class="absolute z-50 bottom-4 right-6">
<div *ngIf="sticky && !mobileView && !manuallyClosed" class="absolute z-50 bottom-4 right-6">
<button
class="absolute px-2 pb-0.5 rounded-full -right-3 -top-3 text-gray-900 bg-gray-200 border border-gray-800"
(click)="clickAd()"
Expand Down
2 changes: 2 additions & 0 deletions src/app/shared/components/ads/ads.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class AdsComponent extends BaseComponent implements AfterViewInit, OnDest
lastNavigationTime = 0;
minViewTimeMs = 2000;
maxViewTimeMs = 8000;
mobileView = false;

constructor(private router: Router, @Inject(PLATFORM_ID) private platformId: Object) {
super();
Expand All @@ -46,6 +47,7 @@ export class AdsComponent extends BaseComponent implements AfterViewInit, OnDest
}

if (isPlatformBrowser(this.platformId)) {
this.mobileView = window.innerWidth < 640; // Tailwind CSS's sm breakpoint
ethicalads.reload();
this.routerSubscription = this.router.events.subscribe(event => {
if (event instanceof NavigationEnd) {
Expand Down

0 comments on commit c8ad926

Please sign in to comment.