feat: optional offset for scrolling iframe to top of screen

This commit is contained in:
Björn Fromme
2025-03-21 17:17:17 +01:00
parent 9ce86ea447
commit 34222b74db
+2 -1
View File
@@ -1,11 +1,12 @@
import { Controller } from '@hotwired/stimulus'
export default class extends Controller {
static values = { offsetTop: { type: Number}}
connect() {
if ('parentIframe' in window) {
window.iFrameResizer = {
onReady: function () {
window.parentIFrame.scrollTo(0, 0)
window.parentIFrame.scrollTo(0, this.offsetTopValue)
}
}
}