Enlève la scrollbar à l'iframe pour éviter les scintillement et les double scrollbar

pull/330/head
Johan Girod 2018-09-04 17:36:58 +02:00
parent f3edfa27bb
commit 7ce383b5df
3 changed files with 17 additions and 1 deletions

View File

@ -7,8 +7,8 @@
}
html:fullscreen {
background-color: white;
overflow: auto !important;
}
body {
overflow-x: hidden !important;
}

View File

@ -0,0 +1,14 @@
import { Component } from 'react'
export default class DisableScroll extends Component {
componentDidMount() {
console.log(document.documentElement)
document.documentElement.style.overflow = 'hidden'
}
componentWillUnmount() {
document.documentElement.style.overflow = ''
}
render() {
return null
}
}

View File

@ -1,5 +1,6 @@
import Mecanisms from 'Components/Mecanisms'
import RulePage from 'Components/RulePage'
import DisableScroll from 'Components/utils/DisableScroll'
import TrackPageView from 'Components/utils/TrackPageView'
import React, { Component } from 'react'
import { Redirect, Route, Switch } from 'react-router-dom'
@ -33,6 +34,7 @@ class EmbaucheRoute extends Component {
onStoreCreated={persistSimulation}>
<TrackPageView />
{!inIframe() && <Header />}
{inIframe() && <DisableScroll />}
<Switch>
<Route exact path="/" component={Home} />
<Route path="/contact" component={Contact} />