FIX: add body class and remove jQuery usage in footer-nav component (#13162)
This commit is contained in:
parent
91ee3fb6e3
commit
787f989fb9
|
@ -38,12 +38,13 @@ const FooterNavComponent = MountWidget.extend(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.capabilities.isIpadOS) {
|
if (this.capabilities.isIpadOS) {
|
||||||
$("body").addClass("footer-nav-ipad");
|
document.body.classList.add("footer-nav-ipad");
|
||||||
} else {
|
} else {
|
||||||
this.bindScrolling({ name: "footer-nav" });
|
this.bindScrolling({ name: "footer-nav" });
|
||||||
$(window).on("resize.footer-nav-on-scroll", () => this.scrolled());
|
window.addEventListener("resize", this.scrolled, false);
|
||||||
this.appEvents.on("composer:opened", this, "_composerOpened");
|
this.appEvents.on("composer:opened", this, "_composerOpened");
|
||||||
this.appEvents.on("composer:closed", this, "_composerClosed");
|
this.appEvents.on("composer:closed", this, "_composerClosed");
|
||||||
|
document.body.classList.add("footer-nav-visible");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -57,10 +58,10 @@ const FooterNavComponent = MountWidget.extend(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.capabilities.isIpadOS) {
|
if (this.capabilities.isIpadOS) {
|
||||||
$("body").removeClass("footer-nav-ipad");
|
document.body.classList.remove("footer-nav-ipad");
|
||||||
} else {
|
} else {
|
||||||
this.unbindScrolling("footer-nav");
|
this.unbindScrolling("footer-nav");
|
||||||
$(window).unbind("resize.footer-nav-on-scroll");
|
window.removeEventListener("resize", this.scrolled);
|
||||||
this.appEvents.off("composer:opened", this, "_composerOpened");
|
this.appEvents.off("composer:opened", this, "_composerOpened");
|
||||||
this.appEvents.off("composer:closed", this, "_composerClosed");
|
this.appEvents.off("composer:closed", this, "_composerClosed");
|
||||||
}
|
}
|
||||||
|
@ -77,12 +78,10 @@ const FooterNavComponent = MountWidget.extend(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const offset = window.pageYOffset || $("html").scrollTop();
|
|
||||||
|
|
||||||
throttle(
|
throttle(
|
||||||
this,
|
this,
|
||||||
this.calculateDirection,
|
this.calculateDirection,
|
||||||
offset,
|
window.pageYOffset,
|
||||||
MOBILE_SCROLL_DIRECTION_CHECK_THROTTLE
|
MOBILE_SCROLL_DIRECTION_CHECK_THROTTLE
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -91,12 +90,11 @@ const FooterNavComponent = MountWidget.extend(
|
||||||
// in the header, otherwise, we hide it.
|
// in the header, otherwise, we hide it.
|
||||||
@observes("mobileScrollDirection")
|
@observes("mobileScrollDirection")
|
||||||
toggleMobileFooter() {
|
toggleMobileFooter() {
|
||||||
$(this.element).toggleClass(
|
this.element.classList.toggle(
|
||||||
"visible",
|
"visible",
|
||||||
this.mobileScrollDirection === null ? true : false
|
this.mobileScrollDirection === null ? true : false
|
||||||
);
|
);
|
||||||
// body class used to adjust positioning of #topic-progress-wrapper
|
document.body.classList.toggle(
|
||||||
$("body").toggleClass(
|
|
||||||
"footer-nav-visible",
|
"footer-nav-visible",
|
||||||
this.mobileScrollDirection === null ? true : false
|
this.mobileScrollDirection === null ? true : false
|
||||||
);
|
);
|
||||||
|
@ -126,14 +124,23 @@ const FooterNavComponent = MountWidget.extend(
|
||||||
},
|
},
|
||||||
|
|
||||||
_modalOn() {
|
_modalOn() {
|
||||||
postRNWebviewMessage(
|
const backdrop = document.querySelector(".modal-backdrop");
|
||||||
"headerBg",
|
if (backdrop) {
|
||||||
$(".modal-backdrop").css("background-color")
|
postRNWebviewMessage(
|
||||||
);
|
"headerBg",
|
||||||
|
getComputedStyle(backdrop)["background-color"]
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_modalOff() {
|
_modalOff() {
|
||||||
postRNWebviewMessage("headerBg", $(".d-header").css("background-color"));
|
const dheader = document.querySelector(".d-header");
|
||||||
|
if (dheader) {
|
||||||
|
postRNWebviewMessage(
|
||||||
|
"headerBg",
|
||||||
|
getComputedStyle(dheader)["background-color"]
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
goBack() {
|
goBack() {
|
||||||
|
|
Loading…
Reference in New Issue