Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

226
Vistas
CSS: allow only scrolling in <iframe>

I'm trying to embed a google document iframe inside of Google-Apps-Scripts-made webapp, however I don't want the users to have the ability to change the insides of the document inside the frame, rather just 'preview' it.

After deeming adding an event handler to the iframe impossible, I have succeeded in disabling every kind of input by using pointer-events: none;, however I still want the users to be able to scroll the insides of the iframe.

Could you help me in any way?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I have solved by wrapping the iframe in a <div>, disabling pointer events and then adding an on mouse wheel movement event which triggers the change of the style attribute in the iframe, then after 250ms switching it pointer-events: none back again. Please find my solution attached:

<body>
  <div id="wrapper" >
       <iframe id='docFrame' style="pointer-events: none;" width="600" height="700"
        src="googledocexample.com"></iframe>
  </div>
</body>

<script>

    $(document).ready(function() {
        $('#wrapper').on('wheel', function () {
            $('#docFrame').prop('style', '')
            console.log('iframe active')
            setTimeout(() => {
                $('#docFrame').prop('style', 'pointer-events: none;')
                console.log('iframe dead')
            }, 250)
        })
    })

</script>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda