feat: optional offset for scrolling iframe to top of screen
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
import { Controller } from '@hotwired/stimulus'
|
import { Controller } from '@hotwired/stimulus'
|
||||||
|
|
||||||
export default class extends Controller {
|
export default class extends Controller {
|
||||||
|
static values = { offsetTop: { type: Number}}
|
||||||
connect() {
|
connect() {
|
||||||
if ('parentIframe' in window) {
|
if ('parentIframe' in window) {
|
||||||
window.iFrameResizer = {
|
window.iFrameResizer = {
|
||||||
onReady: function () {
|
onReady: function () {
|
||||||
window.parentIFrame.scrollTo(0, 0)
|
window.parentIFrame.scrollTo(0, this.offsetTopValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user