|
@@ -68,9 +68,9 @@ export function enableMonthlyAnnualSwitching() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export function hideMonthlyAnnualSwitchOnSmallScreen() {
|
|
export function hideMonthlyAnnualSwitchOnSmallScreen() {
|
|
|
- const isSmallScreen = window.matchMedia('(max-width: 767px)').matches
|
|
|
|
|
|
|
+ const smallScreen = window.matchMedia('(max-width: 767px)').matches
|
|
|
|
|
|
|
|
- if (isSmallScreen) {
|
|
|
|
|
|
|
+ if (smallScreen) {
|
|
|
const el = document.querySelector('[data-ol-plans-v2-m-a-switch-container]')
|
|
const el = document.querySelector('[data-ol-plans-v2-m-a-switch-container]')
|
|
|
|
|
|
|
|
el.hidden = true
|
|
el.hidden = true
|
|
@@ -78,9 +78,9 @@ export function hideMonthlyAnnualSwitchOnSmallScreen() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export function showMonthlyAnnualSwitchOnSmallScreen() {
|
|
export function showMonthlyAnnualSwitchOnSmallScreen() {
|
|
|
- const isSmallScreen = window.matchMedia('(max-width: 767px)').matches
|
|
|
|
|
|
|
+ const smallScreen = window.matchMedia('(max-width: 767px)').matches
|
|
|
|
|
|
|
|
- if (isSmallScreen) {
|
|
|
|
|
|
|
+ if (smallScreen) {
|
|
|
const el = document.querySelector('[data-ol-plans-v2-m-a-switch-container]')
|
|
const el = document.querySelector('[data-ol-plans-v2-m-a-switch-container]')
|
|
|
|
|
|
|
|
el.hidden = false
|
|
el.hidden = false
|
|
@@ -107,10 +107,7 @@ export function hideMonthlyAnnualTooltip() {
|
|
|
function switchMonthlyAnnualTooltip() {
|
|
function switchMonthlyAnnualTooltip() {
|
|
|
const el = document.querySelector('[data-ol-plans-v2-m-a-tooltip]')
|
|
const el = document.querySelector('[data-ol-plans-v2-m-a-tooltip]')
|
|
|
if (currentMonthlyAnnualSwitchValue === 'annual') {
|
|
if (currentMonthlyAnnualSwitchValue === 'annual') {
|
|
|
- el.classList.replace(
|
|
|
|
|
- 'plans-v2-m-a-tooltip-annual',
|
|
|
|
|
- 'plans-v2-m-a-tooltip-monthly'
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ el.classList.remove('plans-v2-m-a-tooltip-annual-selected')
|
|
|
document.querySelectorAll('[data-ol-tooltip-period]').forEach(childEl => {
|
|
document.querySelectorAll('[data-ol-tooltip-period]').forEach(childEl => {
|
|
|
const period = childEl.getAttribute('data-ol-tooltip-period')
|
|
const period = childEl.getAttribute('data-ol-tooltip-period')
|
|
|
if (period === 'monthly') {
|
|
if (period === 'monthly') {
|
|
@@ -120,10 +117,7 @@ function switchMonthlyAnnualTooltip() {
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
- el.classList.replace(
|
|
|
|
|
- 'plans-v2-m-a-tooltip-monthly',
|
|
|
|
|
- 'plans-v2-m-a-tooltip-annual'
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ el.classList.add('plans-v2-m-a-tooltip-annual-selected')
|
|
|
document.querySelectorAll('[data-ol-tooltip-period]').forEach(childEl => {
|
|
document.querySelectorAll('[data-ol-tooltip-period]').forEach(childEl => {
|
|
|
const period = childEl.getAttribute('data-ol-tooltip-period')
|
|
const period = childEl.getAttribute('data-ol-tooltip-period')
|
|
|
if (period === 'annual') {
|
|
if (period === 'annual') {
|
|
@@ -135,6 +129,17 @@ function switchMonthlyAnnualTooltip() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function changeMonthlyAnnualTooltipPosition() {
|
|
|
|
|
+ const smallScreen = window.matchMedia('(max-width: 767px)').matches
|
|
|
|
|
+ const el = document.querySelector('[data-ol-plans-v2-m-a-tooltip]')
|
|
|
|
|
+
|
|
|
|
|
+ if (smallScreen) {
|
|
|
|
|
+ el.classList.replace('right', 'bottom')
|
|
|
|
|
+ } else {
|
|
|
|
|
+ el.classList.replace('bottom', 'right')
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// month and annual value will each have its own set of tables that we need to
|
|
// month and annual value will each have its own set of tables that we need to
|
|
|
// switch accordingly
|
|
// switch accordingly
|
|
|
function switchMonthlyAnnualTable() {
|
|
function switchMonthlyAnnualTable() {
|
|
@@ -215,4 +220,7 @@ export function setUpMonthlyAnnualSwitching() {
|
|
|
switchMonthlyAnnualTable()
|
|
switchMonthlyAnnualTable()
|
|
|
switchUnderlineText()
|
|
switchUnderlineText()
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+ changeMonthlyAnnualTooltipPosition()
|
|
|
|
|
+ window.addEventListener('resize', changeMonthlyAnnualTooltipPosition)
|
|
|
}
|
|
}
|