Download two scroll with just one

1

What happens is that I'm using frameset in my code html and the page produces the two divisions frameset a scroll, but I want to lower one, the other also lower. Is there a way to do it?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>
<?php
  include "../funciones_saraweb.php"; 
?>
<frameset rows="59,360" cols="1119*" frameborder="no">
  <frame src="titulo.php" id="titulo" />

  <frameset rows="*" cols="619,710">
    <frameset rows="*" cols="277,336" frameborder="no">
      <frame src="centrales.php" id="centrales" />
      <frame src="clasificacion.php" id="clasificacion" />
    </frameset>

    <frame src="status_alarm.php" id="status_alarm" />
  </frameset>
</frameset>
<noframes><body>
</body>
</noframes>
</html>

This is my code, help me, thank you.

    
asked by Shack 12.10.2018 в 16:35
source

1 answer

2

You can use the event scroll of the DOM, controlled by JS:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>

<head>
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
    <meta content="utf-8" http-equiv="encoding">
    <script type="text/javascript">

        function main() {
            // Asumiendo que querés scroll la misma cantidad que el frame 'centrales'.
            // Si no es así, reemplazar por el frame que querés usar como referencia
            document.getElementById('centrales').contentWindow.addEventListener('scroll', function () {
                // scrollTop representa la cantidad de pixeles a scrollear
                let scrollTop = (centralesWindow.pageYOffset !== undefined) ? centralesWindow.pageYOffset : (centralesWindow.document.documentElement || centralesWindow.document.body.parentNode || centralesWindow.document.body).scrollTop;

                // Obtener el elemento (frame) a aplicar el scroll
                document.getElementById('clasificacion').contentWindow.scroll(0, scrollTop);

            });;
        }

    </script>
</head>
<frameset rows="59,360" cols="1119*" frameborder="no">
    <frame src="titulo.php" id="titulo" />
    <frameset rows="*" cols="619,710" onLoad="javascript:main()">
        <frameset rows="*" cols="277,336" frameborder="yes">
            <frame src="centrales.php" id="centrales" />
            <frame src="clasificacion.php" id="clasificacion" />
        </frameset>

        <frame src="#" id="status_alarm" />
    </frameset>
</frameset>
<noframes>
<body></body>
</html>
    
answered by 12.10.2018 / 17:08
source