Tema para preguntas random a Chatgpt 🤖

  • Autor Autor Carlos Arreola
  • Fecha de inicio Fecha de inicio
Estado

🔒 Este tema está cerrado para nuevas respuestas.

⏰ Solo el creador del tema puede solicitar la reapertura de sus propios temas, pero únicamente dentro de los 60 días previos a la última actualización.

Para mejorar la lógica y asegurarte de que no se elimine el src de los iframes que están en pantalla completa y tienen la clase vidplay, puedes agregar una verificación en el ciclo forEach para verificar si el iframe actual tiene la clase vidplay.

Aquí tienes el código modificado:

JavaScript:
loadTimeouts = setInterval(() => {
    const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
    iframes.forEach(otherIframe => {
        const otherIframeDataId = otherIframe.getAttribute("dataid");

        // Comprobar si el iframe no está en pantalla completa y tiene la clase vidplay
        if (!otherIframe.classList.contains('vidplay')) {
            // Comprobar si no existe el elemento .laggs con el dataid correspondiente
            if ($(".laggs[dataid='" + otherIframeDataId + "']").length === 0) {
                $(otherIframe).removeAttr('src'); // Eliminar el src de otros iframes

                // Prepend para agregar mensaje de carga
                $(".freimps" + otherIframeDataId).prepend(
                    '<div class="laggs" dataid="' + otherIframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
                );
            }
        }
    });
}, 300);

### Cambios Realizados:

1. Verificación de Clase vidplay: Se agregó la condición !otherIframe.classList.contains('vidplay') para asegurarse de que el src no se borre si el iframe tiene la clase vidplay.

### Resumen:

Con esta mejora, el código ya no eliminará el src de los iframes que están en pantalla completa y que tienen la clase vidplay. Esto mantendrá el video en reproducción sin interrupciones.

Prueba el código y, si necesitas más cambios o ajustes, ¡dímelo!
loadTimeouts = setInterval(() => {
const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
const targetDataId = dataId;
iframes.forEach(iframe => {
const iframeDataId = iframe.getAttribute("dataid");
const iframeWindow = iframe.contentWindow;
const video = iframeWindow.document.getElementsByClassName('vidplay')[0];
if(video && !video.paused && iframeDataId !== targetDataId){
video.pause();
}
});
}, 300); un ejemplo ve. aqui esta el video dentro del iframe, arreglalo para que borre solo los src de los iframes que no estan observados
 
loadTimeouts = setInterval(() => {
const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
const targetDataId = dataId;
iframes.forEach(iframe => {
const iframeDataId = iframe.getAttribute("dataid");
const iframeWindow = iframe.contentWindow;
const video = iframeWindow.document.getElementsByClassName('vidplay')[0];
if(video && !video.paused && iframeDataId !== targetDataId){
video.pause();
}
});
}, 300); un ejemplo ve. aqui esta el video dentro del iframe, arreglalo para que borre solo los src de los iframes que no estan observados
Para asegurarte de que solo se borre el src de los iframes que no están siendo observados y que no tienen un video en reproducción, debes ajustar el código para verificar si el video está activo. Aquí tienes una versión modificada de tu código que implementa esta lógica:

JavaScript:
loadTimeouts = setInterval(() => {
    const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
    const targetDataId = dataId; // ID del iframe actualmente en uso.

    iframes.forEach(iframe => {
        const iframeDataId = iframe.getAttribute("dataid");
        const iframeWindow = iframe.contentWindow;

        // Verifica si el iframe tiene un video con clase 'vidplay'
        const video = iframeWindow.document.getElementsByClassName('vidplay')[0];
        
        // Si hay un video y no está pausado, no hacer nada
        if (video && !video.paused) {
            return; // No se hace nada, ya que este iframe tiene un video reproduciéndose.
        }

        // Si el iframe no es el actualmente observado, eliminar el src
        if (iframeDataId !== targetDataId) {
            $(iframe).removeAttr('src'); // Borra el src del iframe no observado

            // También podrías agregar un mensaje de carga si lo necesitas
            $(".freimps" + iframeDataId).prepend(
                '<div class="laggs" dataid="' + iframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
            );
        }
    });
}, 300);

### Cambios Realizados:

1. Verificación de Video Activo: Se verifica si hay un video en el iframe con la clase vidplay y si no está pausado. Si está activo, se retorna y no se borrarán los src de ese iframe.

2. Condición para Borrar src: Solo se borra el src si el iframeDataId no es igual al targetDataId.

3. Manejo de Mensaje de Carga: Se mantiene la opción de agregar un mensaje de carga cuando se borra el src.

### Resumen:

Con estas modificaciones, solo se borrará el src de los iframes que no están siendo observados y que no tienen un video en reproducción. Prueba el código y si tienes más requerimientos o ajustes, ¡estaré encantado de ayudar!
 
Para asegurarte de que solo se borre el src de los iframes que no están siendo observados y que no tienen un video en reproducción, debes ajustar el código para verificar si el video está activo. Aquí tienes una versión modificada de tu código que implementa esta lógica:

JavaScript:
loadTimeouts = setInterval(() => {
    const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
    const targetDataId = dataId; // ID del iframe actualmente en uso.

    iframes.forEach(iframe => {
        const iframeDataId = iframe.getAttribute("dataid");
        const iframeWindow = iframe.contentWindow;

        // Verifica si el iframe tiene un video con clase 'vidplay'
        const video = iframeWindow.document.getElementsByClassName('vidplay')[0];
       
        // Si hay un video y no está pausado, no hacer nada
        if (video && !video.paused) {
            return; // No se hace nada, ya que este iframe tiene un video reproduciéndose.
        }

        // Si el iframe no es el actualmente observado, eliminar el src
        if (iframeDataId !== targetDataId) {
            $(iframe).removeAttr('src'); // Borra el src del iframe no observado

            // También podrías agregar un mensaje de carga si lo necesitas
            $(".freimps" + iframeDataId).prepend(
                '<div class="laggs" dataid="' + iframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
            );
        }
    });
}, 300);

### Cambios Realizados:

1. Verificación de Video Activo: Se verifica si hay un video en el iframe con la clase vidplay y si no está pausado. Si está activo, se retorna y no se borrarán los src de ese iframe.

2. Condición para Borrar src: Solo se borra el src si el iframeDataId no es igual al targetDataId.

3. Manejo de Mensaje de Carga: Se mantiene la opción de agregar un mensaje de carga cuando se borra el src.

### Resumen:

Con estas modificaciones, solo se borrará el src de los iframes que no están siendo observados y que no tienen un video en reproducción. Prueba el código y si tienes más requerimientos o ajustes, ¡estaré encantado de ayudar!
pero que solo funcione con el ultimo video observado
 
pero que solo funcione con el ultimo video observado
Para hacer que el código solo borre el src de los iframes que no son el último video observado, debes modificar la lógica para almacenar y verificar únicamente el último ID del iframe activo. Aquí tienes la versión actualizada del código:

JavaScript:
loadTimeouts = setInterval(() => {
    const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
    const targetDataId = dataId; // ID del iframe actualmente en uso (último video observado).

    iframes.forEach(iframe => {
        const iframeDataId = iframe.getAttribute("dataid");
        const iframeWindow = iframe.contentWindow;

        // Verifica si el iframe tiene un video con clase 'vidplay'
        const video = iframeWindow.document.getElementsByClassName('vidplay')[0];

        // Si hay un video y no está pausado y es el último video observado, no hacer nada
        if (video && !video.paused && iframeDataId === targetDataId) {
            return; // No se hace nada, ya que este iframe tiene un video reproduciéndose y es el último observado.
        }

        // Si el iframe no es el actualmente observado, eliminar el src
        if (iframeDataId !== targetDataId) {
            $(iframe).removeAttr('src'); // Borra el src del iframe no observado

            // También podrías agregar un mensaje de carga si lo necesitas
            $(".freimps" + iframeDataId).prepend(
                '<div class="laggs" dataid="' + iframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
            );
        }
    });
}, 300);

### Cambios Realizados:

1. Verificación de Video Activo: Se verifica si hay un video en el iframe con la clase vidplay que no está pausado. Si es el último video observado (id coincide con targetDataId), no se borra el src.

2. Condición para Borrar src: Solo se borra el src si el iframeDataId no es igual al targetDataId.

### Resumen:

Con estos cambios, el código solo borrará el src de los iframes que no son el último video observado y no eliminará el src del video que se esté reproduciendo en ese iframe. Prueba el código y si tienes más ajustes o preguntas, ¡déjamelo saber!
 
Para hacer que el código solo borre el src de los iframes que no son el último video observado, debes modificar la lógica para almacenar y verificar únicamente el último ID del iframe activo. Aquí tienes la versión actualizada del código:

JavaScript:
loadTimeouts = setInterval(() => {
    const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
    const targetDataId = dataId; // ID del iframe actualmente en uso (último video observado).

    iframes.forEach(iframe => {
        const iframeDataId = iframe.getAttribute("dataid");
        const iframeWindow = iframe.contentWindow;

        // Verifica si el iframe tiene un video con clase 'vidplay'
        const video = iframeWindow.document.getElementsByClassName('vidplay')[0];

        // Si hay un video y no está pausado y es el último video observado, no hacer nada
        if (video && !video.paused && iframeDataId === targetDataId) {
            return; // No se hace nada, ya que este iframe tiene un video reproduciéndose y es el último observado.
        }

        // Si el iframe no es el actualmente observado, eliminar el src
        if (iframeDataId !== targetDataId) {
            $(iframe).removeAttr('src'); // Borra el src del iframe no observado

            // También podrías agregar un mensaje de carga si lo necesitas
            $(".freimps" + iframeDataId).prepend(
                '<div class="laggs" dataid="' + iframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
            );
        }
    });
}, 300);

### Cambios Realizados:

1. Verificación de Video Activo: Se verifica si hay un video en el iframe con la clase vidplay que no está pausado. Si es el último video observado (id coincide con targetDataId), no se borra el src.

2. Condición para Borrar src: Solo se borra el src si el iframeDataId no es igual al targetDataId.

### Resumen:

Con estos cambios, el código solo borrará el src de los iframes que no son el último video observado y no eliminará el src del video que se esté reproduciendo en ese iframe. Prueba el código y si tienes más ajustes o preguntas, ¡déjamelo saber!
pero porque cuando coloco el video en pantalla grande se reproduce otro?
 
pero porque cuando coloco el video en pantalla grande se reproduce otro?
El problema de que otro video se reproduzca al poner uno en pantalla grande puede ocurrir si el código no está manejando adecuadamente el estado del iframe que se está reproduciendo. A continuación, te presento una solución que se asegura de que solo se cargue el video correspondiente al iframe que está en pantalla grande.

### Solución Propuesta

1. Asegúrate de cambiar el src del iframe que va a estar en pantalla grande.
2. Evita que el src de otros iframes se borre mientras el video correspondiente está en pantalla grande.

Aquí te dejo un ejemplo de cómo podrías estructurarlo:

JavaScript:
// Al poner en pantalla grande
function toggleFullScreen(iframe) {
    if (!document.fullscreenElement) {
        iframe.requestFullscreen().catch(err => {
            console.error(`Error attempting to enable full-screen mode: ${err.message}`);
        });
    } else {
        if (document.exitFullscreen) {
            document.exitFullscreen();
        }
    }
}

// Usa el evento para manejar el clic y cargar el video
$(".sessim .octumpro[data-src]").on('dblclick', function() {
    const dataId = $(this).attr('dataid');
    const videoInIframe = this.contentWindow.document.getElementsByClassName('vidplay')[0];

    // Si el video no está reproduciéndose, se carga
    if (videoInIframe && videoInIframe.paused) {
        toggleFullScreen(this);
    } else {
        // Si el video ya está en reproducción, simplemente entra en fullscreen
        toggleFullScreen(this);
    }
});

// Intervalo para limpiar los src de iframes no observados
loadTimeouts = setInterval(() => {
    const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
    const targetDataId = dataId; // ID del iframe actualmente en uso.

    iframes.forEach(iframe => {
        const iframeDataId = iframe.getAttribute("dataid");
        const iframeWindow = iframe.contentWindow;

        // Verifica si el iframe tiene un video con clase 'vidplay'
        const video = iframeWindow.document.getElementsByClassName('vidplay')[0];

        // Si hay un video y no está pausado y es el último video observado, no hacer nada
        if (video && !video.paused && iframeDataId === targetDataId) {
            return; // No se hace nada, ya que este iframe tiene un video reproduciéndose.
        }

        // Si el iframe no es el actualmente observado, eliminar el src
        if (iframeDataId !== targetDataId) {
            $(iframe).removeAttr('src'); // Borra el src del iframe no observado

            // También podrías agregar un mensaje de carga si lo necesitas
            $(".freimps" + iframeDataId).prepend(
                '<div class="laggs" dataid="' + iframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
            );
        }
    });
}, 300);

### Resumen:

1. Se asegura de que al hacer doble clic en el video, solo el iframe correspondiente se cargue en pantalla grande.
2. Se verifica si el video en el iframe actual está en reproducción antes de permitir que se muestre.
3. Solo se elimina el src de los iframes que no están siendo observados.

Con estas modificaciones, deberías obtener el comportamiento deseado. Prueba el código y déjame saber si hay algo más que pueda ayudarte a resolver.
 
El problema de que otro video se reproduzca al poner uno en pantalla grande puede ocurrir si el código no está manejando adecuadamente el estado del iframe que se está reproduciendo. A continuación, te presento una solución que se asegura de que solo se cargue el video correspondiente al iframe que está en pantalla grande.

### Solución Propuesta

1. Asegúrate de cambiar el src del iframe que va a estar en pantalla grande.
2. Evita que el src de otros iframes se borre mientras el video correspondiente está en pantalla grande.

Aquí te dejo un ejemplo de cómo podrías estructurarlo:

JavaScript:
// Al poner en pantalla grande
function toggleFullScreen(iframe) {
    if (!document.fullscreenElement) {
        iframe.requestFullscreen().catch(err => {
            console.error(`Error attempting to enable full-screen mode: ${err.message}`);
        });
    } else {
        if (document.exitFullscreen) {
            document.exitFullscreen();
        }
    }
}

// Usa el evento para manejar el clic y cargar el video
$(".sessim .octumpro[data-src]").on('dblclick', function() {
    const dataId = $(this).attr('dataid');
    const videoInIframe = this.contentWindow.document.getElementsByClassName('vidplay')[0];

    // Si el video no está reproduciéndose, se carga
    if (videoInIframe && videoInIframe.paused) {
        toggleFullScreen(this);
    } else {
        // Si el video ya está en reproducción, simplemente entra en fullscreen
        toggleFullScreen(this);
    }
});

// Intervalo para limpiar los src de iframes no observados
loadTimeouts = setInterval(() => {
    const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
    const targetDataId = dataId; // ID del iframe actualmente en uso.

    iframes.forEach(iframe => {
        const iframeDataId = iframe.getAttribute("dataid");
        const iframeWindow = iframe.contentWindow;

        // Verifica si el iframe tiene un video con clase 'vidplay'
        const video = iframeWindow.document.getElementsByClassName('vidplay')[0];

        // Si hay un video y no está pausado y es el último video observado, no hacer nada
        if (video && !video.paused && iframeDataId === targetDataId) {
            return; // No se hace nada, ya que este iframe tiene un video reproduciéndose.
        }

        // Si el iframe no es el actualmente observado, eliminar el src
        if (iframeDataId !== targetDataId) {
            $(iframe).removeAttr('src'); // Borra el src del iframe no observado

            // También podrías agregar un mensaje de carga si lo necesitas
            $(".freimps" + iframeDataId).prepend(
                '<div class="laggs" dataid="' + iframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
            );
        }
    });
}, 300);

### Resumen:

1. Se asegura de que al hacer doble clic en el video, solo el iframe correspondiente se cargue en pantalla grande.
2. Se verifica si el video en el iframe actual está en reproducción antes de permitir que se muestre.
3. Solo se elimina el src de los iframes que no están siendo observados.

Con estas modificaciones, deberías obtener el comportamiento deseado. Prueba el código y déjame saber si hay algo más que pueda ayudarte a resolver.
puedes hacer un codigo que detecte cuando haga click sobre un boton dentro de un iframe?
el boton tiene class .scale
 
puedes hacer un codigo que detecte cuando haga click sobre un boton dentro de un iframe?
el boton tiene class .scale
Claro, aquí tienes un ejemplo de cómo detectar un clic en un botón dentro de un iframe que tiene la clase .scale. Para hacerlo, puedes usar un event listener en el documento del iframe. A continuación te muestro cómo hacerlo:

### Ejemplo de Código:

1. Asegúrate de que tu iframe y el botón existan en el mismo dominio (debido a políticas de seguridad de navegador, no puedes acceder a iframes de dominios diferentes).

2. Aquí está el código:

JavaScript:
// Supongamos que tienes un iframe con un id 'myIframe'
const iframe = document.getElementById('myIframe');

// Asegúrate de que el iframe esté completamente cargado
iframe.onload = function() {
    const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;

    // Agrega un listener al botón dentro del iframe
    const scaleButton = iframeDocument.querySelector('.scale');

    if (scaleButton) {
        scaleButton.addEventListener('click', function() {
            console.log('Botón escala clicado dentro del iframe');
            // Aquí puedes agregar la lógica que desees
        });
    } else {
        console.log('No se encontró el botón con clase .scale en el iframe.');
    }
};

### Explicación:

  • Obtener el iframe: Se obtiene el iframe a través de su ID (myIframe).
  • Esperar a que el iframe esté cargado: Se usa el evento onload del iframe para asegurarse de que su contenido esté completamente cargado antes de intentar acceder a él.
  • Seleccionar el botón: Se busca el botón con la clase .scale dentro del documento del iframe.
  • Agregar un event listener: Se añade un listener al botón para detectar clics y ejecutar la lógica deseada.

### Notas:

  • Asegúrate de que el iframe esté en el mismo dominio para evitar problemas de Cross-Origin Resource Sharing (CORS).
  • Si el iframe puede ser reemplazado o el contenido se actualiza dinámicamente, es posible que necesites observar cambios o agregar el listener nuevamente.

Prueba este código y házmelo saber si necesitas adaptaciones adicionales o más ayuda. ¡Estoy aquí para ayudar!
 
Claro, aquí tienes un ejemplo de cómo detectar un clic en un botón dentro de un iframe que tiene la clase .scale. Para hacerlo, puedes usar un event listener en el documento del iframe. A continuación te muestro cómo hacerlo:

### Ejemplo de Código:

1. Asegúrate de que tu iframe y el botón existan en el mismo dominio (debido a políticas de seguridad de navegador, no puedes acceder a iframes de dominios diferentes).

2. Aquí está el código:

JavaScript:
// Supongamos que tienes un iframe con un id 'myIframe'
const iframe = document.getElementById('myIframe');

// Asegúrate de que el iframe esté completamente cargado
iframe.onload = function() {
    const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;

    // Agrega un listener al botón dentro del iframe
    const scaleButton = iframeDocument.querySelector('.scale');

    if (scaleButton) {
        scaleButton.addEventListener('click', function() {
            console.log('Botón escala clicado dentro del iframe');
            // Aquí puedes agregar la lógica que desees
        });
    } else {
        console.log('No se encontró el botón con clase .scale en el iframe.');
    }
};

### Explicación:

  • Obtener el iframe: Se obtiene el iframe a través de su ID (myIframe).
  • Esperar a que el iframe esté cargado: Se usa el evento onload del iframe para asegurarse de que su contenido esté completamente cargado antes de intentar acceder a él.
  • Seleccionar el botón: Se busca el botón con la clase .scale dentro del documento del iframe.
  • Agregar un event listener: Se añade un listener al botón para detectar clics y ejecutar la lógica deseada.

### Notas:

  • Asegúrate de que el iframe esté en el mismo dominio para evitar problemas de Cross-Origin Resource Sharing (CORS).
  • Si el iframe puede ser reemplazado o el contenido se actualiza dinámicamente, es posible que necesites observar cambios o agregar el listener nuevamente.

Prueba este código y házmelo saber si necesitas adaptaciones adicionales o más ayuda. ¡Estoy aquí para ayudar!
$(document).ready(function() {
const options = {
root: null,
threshold: 0.6
};

let loadTimeouts;
let observer3 = new IntersectionObserver((entries) => {
entries.forEach(entry => {
const dataId = entry.target.getAttribute('dataid');
const iframe = entry.target;

if (entry.isIntersecting) {
// Asignar src si está vacío
if (!iframe.src || iframe.src === "") {
iframe.src = iframe.getAttribute("data-src");
iframe.onload = function() {
$(".laggs[dataid='" + dataId + "']").remove();
};
}

// Controlar y limpiar src de otros iframes
loadTimeouts = setInterval(() => {
const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
iframes.forEach(otherIframe => {
const otherIframeDataId = otherIframe.getAttribute("dataid");
if (otherIframeDataId !== dataId) {
// Comprobar si no existe el elemento .laggs con el dataid correspondiente
if ($(".laggs[dataid='" + otherIframeDataId + "']").length === 0) {
$(otherIframe).removeAttr('src'); // Eliminar el src de otros iframes

// Prepend para agregar mensaje de carga
$(".freimps" + otherIframeDataId).prepend(
'<div class="laggs" dataid="' + otherIframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
);
}
}
});
}, 300);
} else {
clearInterval(loadTimeouts);
}
});
}, options);

function observeLogamDivs2() {
document.querySelectorAll('.sessim .octumpro[data-src]').forEach(elem => {
if (elem instanceof Node) {
observer3.observe(elem);
}
});
}

observeLogamDivs2();

let mutationObserver3 = new MutationObserver((mutations) => {
mutations.forEach(mutation => {
mutation.addedNodes.forEach(node => {
if (node.nodeType === 1) {
const iframes = node.querySelectorAll('.sessim .octumpro[data-src]');
iframes.forEach(iframe => {
if (iframe instanceof Node) {
observer3.observe(iframe);

// Asignar el src nuevamente si es necesario al volver a observar
if (!iframe.src || iframe.src === "") {
iframe.src = iframe.getAttribute("data-src");
iframe.onload = function() {
$(".laggs[dataid='" + iframe.getAttribute('dataid') + "']").remove();
};
}
}
});
}
});
});
});

const targetNode = document.querySelector('.moreinfo');
if (targetNode) {
mutationObserver3.observe(targetNode, {
childList: true,
subtree: true
});
}

// Función para manejar pantalla completa
function toggleFullScreen(element) {
if (!document.fullscreenElement) {
element.requestFullscreen().catch(err => {
console.error(Error attempting to enable full-screen mode: ${err.message});
});
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
}
}
}

// Añade un event listener para el elemento de video para activar fullscreen
$(".sessim .octumpro[data-src]").on('dblclick', function() {
toggleFullScreen(this);
});
});

pero hazlo aqui, que detecte el click dentro del video observado
 
$(document).ready(function() {
const options = {
root: null,
threshold: 0.6
};

let loadTimeouts;
let observer3 = new IntersectionObserver((entries) => {
entries.forEach(entry => {
const dataId = entry.target.getAttribute('dataid');
const iframe = entry.target;

if (entry.isIntersecting) {
// Asignar src si está vacío
if (!iframe.src || iframe.src === "") {
iframe.src = iframe.getAttribute("data-src");
iframe.onload = function() {
$(".laggs[dataid='" + dataId + "']").remove();
};
}

// Controlar y limpiar src de otros iframes
loadTimeouts = setInterval(() => {
const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
iframes.forEach(otherIframe => {
const otherIframeDataId = otherIframe.getAttribute("dataid");
if (otherIframeDataId !== dataId) {
// Comprobar si no existe el elemento .laggs con el dataid correspondiente
if ($(".laggs[dataid='" + otherIframeDataId + "']").length === 0) {
$(otherIframe).removeAttr('src'); // Eliminar el src de otros iframes

// Prepend para agregar mensaje de carga
$(".freimps" + otherIframeDataId).prepend(
'<div class="laggs" dataid="' + otherIframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
);
}
}
});
}, 300);
} else {
clearInterval(loadTimeouts);
}
});
}, options);

function observeLogamDivs2() {
document.querySelectorAll('.sessim .octumpro[data-src]').forEach(elem => {
if (elem instanceof Node) {
observer3.observe(elem);
}
});
}

observeLogamDivs2();

let mutationObserver3 = new MutationObserver((mutations) => {
mutations.forEach(mutation => {
mutation.addedNodes.forEach(node => {
if (node.nodeType === 1) {
const iframes = node.querySelectorAll('.sessim .octumpro[data-src]');
iframes.forEach(iframe => {
if (iframe instanceof Node) {
observer3.observe(iframe);

// Asignar el src nuevamente si es necesario al volver a observar
if (!iframe.src || iframe.src === "") {
iframe.src = iframe.getAttribute("data-src");
iframe.onload = function() {
$(".laggs[dataid='" + iframe.getAttribute('dataid') + "']").remove();
};
}
}
});
}
});
});
});

const targetNode = document.querySelector('.moreinfo');
if (targetNode) {
mutationObserver3.observe(targetNode, {
childList: true,
subtree: true
});
}

// Función para manejar pantalla completa
function toggleFullScreen(element) {
if (!document.fullscreenElement) {
element.requestFullscreen().catch(err => {
console.error(Error attempting to enable full-screen mode: ${err.message});
});
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
}
}
}

// Añade un event listener para el elemento de video para activar fullscreen
$(".sessim .octumpro[data-src]").on('dblclick', function() {
toggleFullScreen(this);
});
});

pero hazlo aqui, que detecte el click dentro del video observado
Para detectar un clic dentro del video observado en el iframe, primero necesitas asegurarte de que estás accediendo al contenido del iframe y luego agregar un event listener a ese contenido. Aquí tienes cómo puedes modificar tu código para incluir esa funcionalidad:

### Código Modificado:

A continuación, integro un detector de clics dentro del iframe cuando el video se está reproduciendo:

JavaScript:
$(document).ready(function() {
    const options = {
        root: null,
        threshold: 0.6
    };

    let loadTimeouts;
    let observer3 = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            const dataId = entry.target.getAttribute('dataid');
            const iframe = entry.target;

            if (entry.isIntersecting) {
                // Asignar src si está vacío
                if (!iframe.src || iframe.src === "") {
                    iframe.src = iframe.getAttribute("data-src");
                    iframe.onload = function() {
                        $(".laggs[dataid='" + dataId + "']").remove();

                        // Agregar un listener para detectar clics dentro del iframe
                        const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
                        const videoElement = iframeDocument.querySelector('.vidplay'); // Reemplaza '.vidplay' por la clase correcta si es diferente

                        if (videoElement) {
                            videoElement.addEventListener('click', function() {
                                console.log('Clic en el video dentro del iframe con dataid:', dataId);
                                // Ejecuta la lógica que quieras al hacer clic en el video
                            });
                        }
                    };
                }

                // Controlar y limpiar src de otros iframes
                loadTimeouts = setInterval(() => {
                    const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
                    iframes.forEach(otherIframe => {
                        const otherIframeDataId = otherIframe.getAttribute("dataid");
                        if (otherIframeDataId !== dataId) {
                            // Comprobar si no existe el elemento .laggs con el dataid correspondiente
                            if ($(".laggs[dataid='" + otherIframeDataId + "']").length === 0) {
                                $(otherIframe).removeAttr('src'); // Eliminar el src de otros iframes

                                // Prepend para agregar mensaje de carga
                                $(".freimps" + otherIframeDataId).prepend(
                                    '<div class="laggs" dataid="' + otherIframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
                                );
                            }
                        }
                    });
                }, 300);
            } else {
                clearInterval(loadTimeouts);
            }
        });
    }, options);

    function observeLogamDivs2() {
        document.querySelectorAll('.sessim .octumpro[data-src]').forEach(elem => {
            if (elem instanceof Node) {
                observer3.observe(elem);
            }
        });
    }

    observeLogamDivs2();

    let mutationObserver3 = new MutationObserver((mutations) => {
        mutations.forEach(mutation => {
            mutation.addedNodes.forEach(node => {
                if (node.nodeType === 1) {
                    const iframes = node.querySelectorAll('.sessim .octumpro[data-src]');
                    iframes.forEach(iframe => {
                        if (iframe instanceof Node) {
                            observer3.observe(iframe);

                            // Asignar el src nuevamente si es necesario al volver a observar
                            if (!iframe.src || iframe.src === "") {
                                iframe.src = iframe.getAttribute("data-src");
                                iframe.onload = function() {
                                    $(".laggs[dataid='" + iframe.getAttribute('dataid') + "']").remove();

                                    // Agregar un listener para detectar clics dentro del iframe
                                    const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
                                    const videoElement = iframeDocument.querySelector('.vidplay');

                                    if (videoElement) {
                                        videoElement.addEventListener('click', function() {
                                            console.log('Clic en el video dentro del iframe con dataid:', iframe.getAttribute('dataid'));
                                            // Ejecuta la lógica que quieras al hacer clic en el video
                                        });
                                    }
                                };
                            }
                        }
                    });
                }
            });
        });
    });

    const targetNode = document.querySelector('.moreinfo');
    if (targetNode) {
        mutationObserver3.observe(targetNode, {
            childList: true,
            subtree: true
        });
    }

    // Función para manejar pantalla completa
    function toggleFullScreen(element) {
        if (!document.fullscreenElement) {
            element.requestFullscreen().catch(err => {
                console.error(`Error attempting to enable full-screen mode: ${err.message}`);
            });
        } else {
            if (document.exitFullscreen) {
                document.exitFullscreen();
            }
        }
    }

    // Añade un event listener para el elemento de video para activar fullscreen
    $(".sessim .octumpro[data-src]").on('dblclick', function() {
        toggleFullScreen(this);
    });
});

### Explicación de Cambios:

1. Agregar un Listener al Video: Dentro del evento onload del iframe, se agrega un event listener al elemento de video que tiene la clase .vidplay. Esto permite detectar clics en el video.

2. Manejo de Clics: Cuando se detecta un clic en el video, se imprime un mensaje en la consola y puedes agregar cualquier lógica adicional que necesites.

Con estas modificaciones, deberías poder detectar clics en el video dentro del iframe observado. Prueba el código y si tienes más preguntas o necesitas ajustes, ¡estaré encantado de ayudar!
 
Para detectar un clic dentro del video observado en el iframe, primero necesitas asegurarte de que estás accediendo al contenido del iframe y luego agregar un event listener a ese contenido. Aquí tienes cómo puedes modificar tu código para incluir esa funcionalidad:

### Código Modificado:

A continuación, integro un detector de clics dentro del iframe cuando el video se está reproduciendo:

JavaScript:
$(document).ready(function() {
    const options = {
        root: null,
        threshold: 0.6
    };

    let loadTimeouts;
    let observer3 = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            const dataId = entry.target.getAttribute('dataid');
            const iframe = entry.target;

            if (entry.isIntersecting) {
                // Asignar src si está vacío
                if (!iframe.src || iframe.src === "") {
                    iframe.src = iframe.getAttribute("data-src");
                    iframe.onload = function() {
                        $(".laggs[dataid='" + dataId + "']").remove();

                        // Agregar un listener para detectar clics dentro del iframe
                        const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
                        const videoElement = iframeDocument.querySelector('.vidplay'); // Reemplaza '.vidplay' por la clase correcta si es diferente

                        if (videoElement) {
                            videoElement.addEventListener('click', function() {
                                console.log('Clic en el video dentro del iframe con dataid:', dataId);
                                // Ejecuta la lógica que quieras al hacer clic en el video
                            });
                        }
                    };
                }

                // Controlar y limpiar src de otros iframes
                loadTimeouts = setInterval(() => {
                    const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
                    iframes.forEach(otherIframe => {
                        const otherIframeDataId = otherIframe.getAttribute("dataid");
                        if (otherIframeDataId !== dataId) {
                            // Comprobar si no existe el elemento .laggs con el dataid correspondiente
                            if ($(".laggs[dataid='" + otherIframeDataId + "']").length === 0) {
                                $(otherIframe).removeAttr('src'); // Eliminar el src de otros iframes

                                // Prepend para agregar mensaje de carga
                                $(".freimps" + otherIframeDataId).prepend(
                                    '<div class="laggs" dataid="' + otherIframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
                                );
                            }
                        }
                    });
                }, 300);
            } else {
                clearInterval(loadTimeouts);
            }
        });
    }, options);

    function observeLogamDivs2() {
        document.querySelectorAll('.sessim .octumpro[data-src]').forEach(elem => {
            if (elem instanceof Node) {
                observer3.observe(elem);
            }
        });
    }

    observeLogamDivs2();

    let mutationObserver3 = new MutationObserver((mutations) => {
        mutations.forEach(mutation => {
            mutation.addedNodes.forEach(node => {
                if (node.nodeType === 1) {
                    const iframes = node.querySelectorAll('.sessim .octumpro[data-src]');
                    iframes.forEach(iframe => {
                        if (iframe instanceof Node) {
                            observer3.observe(iframe);

                            // Asignar el src nuevamente si es necesario al volver a observar
                            if (!iframe.src || iframe.src === "") {
                                iframe.src = iframe.getAttribute("data-src");
                                iframe.onload = function() {
                                    $(".laggs[dataid='" + iframe.getAttribute('dataid') + "']").remove();

                                    // Agregar un listener para detectar clics dentro del iframe
                                    const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
                                    const videoElement = iframeDocument.querySelector('.vidplay');

                                    if (videoElement) {
                                        videoElement.addEventListener('click', function() {
                                            console.log('Clic en el video dentro del iframe con dataid:', iframe.getAttribute('dataid'));
                                            // Ejecuta la lógica que quieras al hacer clic en el video
                                        });
                                    }
                                };
                            }
                        }
                    });
                }
            });
        });
    });

    const targetNode = document.querySelector('.moreinfo');
    if (targetNode) {
        mutationObserver3.observe(targetNode, {
            childList: true,
            subtree: true
        });
    }

    // Función para manejar pantalla completa
    function toggleFullScreen(element) {
        if (!document.fullscreenElement) {
            element.requestFullscreen().catch(err => {
                console.error(`Error attempting to enable full-screen mode: ${err.message}`);
            });
        } else {
            if (document.exitFullscreen) {
                document.exitFullscreen();
            }
        }
    }

    // Añade un event listener para el elemento de video para activar fullscreen
    $(".sessim .octumpro[data-src]").on('dblclick', function() {
        toggleFullScreen(this);
    });
});

### Explicación de Cambios:

1. Agregar un Listener al Video: Dentro del evento onload del iframe, se agrega un event listener al elemento de video que tiene la clase .vidplay. Esto permite detectar clics en el video.

2. Manejo de Clics: Cuando se detecta un clic en el video, se imprime un mensaje en la consola y puedes agregar cualquier lógica adicional que necesites.

Con estas modificaciones, deberías poder detectar clics en el video dentro del iframe observado. Prueba el código y si tienes más preguntas o necesitas ajustes, ¡estaré encantado de ayudar!
no me detecta el click
 
no me detecta el click
Si el clic en el botón del video dentro del iframe no se detecta, puede ser debido a algunas razones. Aquí te detallo algunas posibles soluciones:

1. Asegúrate de que el Iframe Pueda Ser Accedido: Si el iframe está cargando contenido de un dominio diferente, no podrás acceder a su contenido directamente debido a las políticas de seguridad del navegador (CORS).

2. Verificar que el Elemento Exista: Asegúrate de que el selector que estás usando para seleccionar el video es correcto y que el video ya está disponible en el iframe en el momento en que agregas el event listener.

3. Uso de Delegación de Eventos: Si el video puede ser reemplazado o cargado dinámicamente, es mejor usar la delegación de eventos. Aquí te muestro cómo puedes hacerlo:

### Código Modificado para Delegación de Eventos:

Aquí tienes una versión que utiliza delegación para manejar los clics:

JavaScript:
$(document).ready(function() {
    const options = {
        root: null,
        threshold: 0.6
    };

    let loadTimeouts;
    let observer3 = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            const dataId = entry.target.getAttribute('dataid');
            const iframe = entry.target;

            if (entry.isIntersecting) {
                // Asignar src si está vacío
                if (!iframe.src || iframe.src === "") {
                    iframe.src = iframe.getAttribute("data-src");
                    iframe.onload = function() {
                        $(".laggs[dataid='" + dataId + "']").remove();

                        // Subscribir al evento de clic en el iframe completo
                        const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;

                        // Usar delegación de eventos en el documento del iframe
                        $(iframeDocument).on('click', '.vidplay', function() {
                            console.log('Clic en el video dentro del iframe con dataid:', dataId);
                            // Aquí puedes agregar la lógica que quieras
                        });
                    };
                }

                // Controlar y limpiar src de otros iframes
                loadTimeouts = setInterval(() => {
                    const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
                    iframes.forEach(otherIframe => {
                        const otherIframeDataId = otherIframe.getAttribute("dataid");
                        if (otherIframeDataId !== dataId) {
                            // Comprobar si no existe el elemento .laggs con el dataid correspondiente
                            if ($(".laggs[dataid='" + otherIframeDataId + "']").length === 0) {
                                $(otherIframe).removeAttr('src'); // Eliminar el src de otros iframes

                                // Prepend para agregar mensaje de carga
                                $(".freimps" + otherIframeDataId).prepend(
                                    '<div class="laggs" dataid="' + otherIframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
                                );
                            }
                        }
                    });
                }, 300);
            } else {
                clearInterval(loadTimeouts);
            }
        });
    }, options);

    function observeLogamDivs2() {
        document.querySelectorAll('.sessim .octumpro[data-src]').forEach(elem => {
            if (elem instanceof Node) {
                observer3.observe(elem);
            }
        });
    }

    observeLogamDivs2();

    let mutationObserver3 = new MutationObserver((mutations) => {
        mutations.forEach(mutation => {
            mutation.addedNodes.forEach(node => {
                if (node.nodeType === 1) {
                    const iframes = node.querySelectorAll('.sessim .octumpro[data-src]');
                    iframes.forEach(iframe => {
                        if (iframe instanceof Node) {
                            observer3.observe(iframe);

                            // Asignar el src nuevamente si es necesario al volver a observar
                            if (!iframe.src || iframe.src === "") {
                                iframe.src = iframe.getAttribute("data-src");
                                iframe.onload = function() {
                                    $(".laggs[dataid='" + iframe.getAttribute('dataid') + "']").remove();
                                    
                                    // Usar delegación de eventos en el documento del iframe
                                    const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
                                    $(iframeDocument).on('click', '.vidplay', function() {
                                        console.log('Clic en el video dentro del iframe con dataid:', iframe.getAttribute('dataid'));
                                        // Aquí puedes agregar la lógica que quieras
                                    });
                                };
                            }
                        }
                    });
                }
            });
        });
    });

    const targetNode = document.querySelector('.moreinfo');
    if (targetNode) {
        mutationObserver3.observe(targetNode, {
            childList: true,
            subtree: true
        });
    }

    // Función para manejar pantalla completa
    function toggleFullScreen(element) {
        if (!document.fullscreenElement) {
            element.requestFullscreen().catch(err => {
                console.error(`Error attempting to enable full-screen mode: ${err.message}`);
            });
        } else {
            if (document.exitFullscreen) {
                document.exitFullscreen();
            }
        }
    }

    // Añade un event listener para el elemento de video para activar fullscreen
    $(".sessim .octumpro[data-src]").on('dblclick', function() {
        toggleFullScreen(this);
    });
});

### Cambios Realizados:

1. Delegación de Eventos: Al usar $(iframeDocument).on('click', '.vidplay', ...), aplicamos delegación, lo que significa que el evento se manejará incluso si el botón es reemplazado o cargado dinámicamente.

2. Verificación de la Clase Correcta: Asegúrate de que la clase vidplay esté correctamente utilizada y sea la que corresponde al video en el iframe.

### Consideraciones:

  • Verificar el Acceso al Iframe: Este código solo funcionará si ambos, el iframe y el documento principal, están en el mismo dominio.
  • Asegúrate de que el Iframe esté Listo: El código de delegación se configura dentro del evento onload, lo que garantiza que se aplique una vez que el contenido esté completamente cargado.

Prueba esta implementación y avísame si encuentras más problemas o si necesitas ayuda adicional. ¡Estoy aquí para ayudar!
 
Si el clic en el botón del video dentro del iframe no se detecta, puede ser debido a algunas razones. Aquí te detallo algunas posibles soluciones:

1. Asegúrate de que el Iframe Pueda Ser Accedido: Si el iframe está cargando contenido de un dominio diferente, no podrás acceder a su contenido directamente debido a las políticas de seguridad del navegador (CORS).

2. Verificar que el Elemento Exista: Asegúrate de que el selector que estás usando para seleccionar el video es correcto y que el video ya está disponible en el iframe en el momento en que agregas el event listener.

3. Uso de Delegación de Eventos: Si el video puede ser reemplazado o cargado dinámicamente, es mejor usar la delegación de eventos. Aquí te muestro cómo puedes hacerlo:

### Código Modificado para Delegación de Eventos:

Aquí tienes una versión que utiliza delegación para manejar los clics:

JavaScript:
$(document).ready(function() {
    const options = {
        root: null,
        threshold: 0.6
    };

    let loadTimeouts;
    let observer3 = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            const dataId = entry.target.getAttribute('dataid');
            const iframe = entry.target;

            if (entry.isIntersecting) {
                // Asignar src si está vacío
                if (!iframe.src || iframe.src === "") {
                    iframe.src = iframe.getAttribute("data-src");
                    iframe.onload = function() {
                        $(".laggs[dataid='" + dataId + "']").remove();

                        // Subscribir al evento de clic en el iframe completo
                        const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;

                        // Usar delegación de eventos en el documento del iframe
                        $(iframeDocument).on('click', '.vidplay', function() {
                            console.log('Clic en el video dentro del iframe con dataid:', dataId);
                            // Aquí puedes agregar la lógica que quieras
                        });
                    };
                }

                // Controlar y limpiar src de otros iframes
                loadTimeouts = setInterval(() => {
                    const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
                    iframes.forEach(otherIframe => {
                        const otherIframeDataId = otherIframe.getAttribute("dataid");
                        if (otherIframeDataId !== dataId) {
                            // Comprobar si no existe el elemento .laggs con el dataid correspondiente
                            if ($(".laggs[dataid='" + otherIframeDataId + "']").length === 0) {
                                $(otherIframe).removeAttr('src'); // Eliminar el src de otros iframes

                                // Prepend para agregar mensaje de carga
                                $(".freimps" + otherIframeDataId).prepend(
                                    '<div class="laggs" dataid="' + otherIframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
                                );
                            }
                        }
                    });
                }, 300);
            } else {
                clearInterval(loadTimeouts);
            }
        });
    }, options);

    function observeLogamDivs2() {
        document.querySelectorAll('.sessim .octumpro[data-src]').forEach(elem => {
            if (elem instanceof Node) {
                observer3.observe(elem);
            }
        });
    }

    observeLogamDivs2();

    let mutationObserver3 = new MutationObserver((mutations) => {
        mutations.forEach(mutation => {
            mutation.addedNodes.forEach(node => {
                if (node.nodeType === 1) {
                    const iframes = node.querySelectorAll('.sessim .octumpro[data-src]');
                    iframes.forEach(iframe => {
                        if (iframe instanceof Node) {
                            observer3.observe(iframe);

                            // Asignar el src nuevamente si es necesario al volver a observar
                            if (!iframe.src || iframe.src === "") {
                                iframe.src = iframe.getAttribute("data-src");
                                iframe.onload = function() {
                                    $(".laggs[dataid='" + iframe.getAttribute('dataid') + "']").remove();
                                   
                                    // Usar delegación de eventos en el documento del iframe
                                    const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
                                    $(iframeDocument).on('click', '.vidplay', function() {
                                        console.log('Clic en el video dentro del iframe con dataid:', iframe.getAttribute('dataid'));
                                        // Aquí puedes agregar la lógica que quieras
                                    });
                                };
                            }
                        }
                    });
                }
            });
        });
    });

    const targetNode = document.querySelector('.moreinfo');
    if (targetNode) {
        mutationObserver3.observe(targetNode, {
            childList: true,
            subtree: true
        });
    }

    // Función para manejar pantalla completa
    function toggleFullScreen(element) {
        if (!document.fullscreenElement) {
            element.requestFullscreen().catch(err => {
                console.error(`Error attempting to enable full-screen mode: ${err.message}`);
            });
        } else {
            if (document.exitFullscreen) {
                document.exitFullscreen();
            }
        }
    }

    // Añade un event listener para el elemento de video para activar fullscreen
    $(".sessim .octumpro[data-src]").on('dblclick', function() {
        toggleFullScreen(this);
    });
});

### Cambios Realizados:

1. Delegación de Eventos: Al usar $(iframeDocument).on('click', '.vidplay', ...), aplicamos delegación, lo que significa que el evento se manejará incluso si el botón es reemplazado o cargado dinámicamente.

2. Verificación de la Clase Correcta: Asegúrate de que la clase vidplay esté correctamente utilizada y sea la que corresponde al video en el iframe.

### Consideraciones:

  • Verificar el Acceso al Iframe: Este código solo funcionará si ambos, el iframe y el documento principal, están en el mismo dominio.
  • Asegúrate de que el Iframe esté Listo: El código de delegación se configura dentro del evento onload, lo que garantiza que se aplique una vez que el contenido esté completamente cargado.

Prueba esta implementación y avísame si encuentras más problemas o si necesitas ayuda adicional. ¡Estoy aquí para ayudar!
haz que funcione solo con el boton que tiene class .scale3 dentro del iframe
 
haz que funcione solo con el boton que tiene class .scale3 dentro del iframe
Para asegurarte de que el código detecte clics solo en el botón con la clase .scale3 dentro del iframe, puedes seguir el siguiente enfoque. Aquí tienes el código modificado para enfocarte en ese botón específico:

### Código Modificado:

JavaScript:
$(document).ready(function() {
    const options = {
        root: null,
        threshold: 0.6
    };

    let loadTimeouts;
    let observer3 = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            const dataId = entry.target.getAttribute('dataid');
            const iframe = entry.target;

            if (entry.isIntersecting) {
                // Asignar src si está vacío
                if (!iframe.src || iframe.src === "") {
                    iframe.src = iframe.getAttribute("data-src");
                    iframe.onload = function() {
                        $(".laggs[dataid='" + dataId + "']").remove();

                        // Subscribir al evento de clic en el iframe completo
                        const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;

                        // Usar delegación de eventos para el botón .scale3 en el iframe
                        $(iframeDocument).on('click', '.scale3', function() {
                            console.log('Clic en el botón .scale3 dentro del iframe con dataid:', dataId);
                            // Aquí puedes agregar la lógica que quieras
                        });
                    };
                }

                // Controlar y limpiar src de otros iframes
                loadTimeouts = setInterval(() => {
                    const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
                    iframes.forEach(otherIframe => {
                        const otherIframeDataId = otherIframe.getAttribute("dataid");
                        if (otherIframeDataId !== dataId) {
                            // Comprobar si no existe el elemento .laggs con el dataid correspondiente
                            if ($(".laggs[dataid='" + otherIframeDataId + "']").length === 0) {
                                $(otherIframe).removeAttr('src'); // Eliminar el src de otros iframes

                                // Prepend para agregar mensaje de carga
                                $(".freimps" + otherIframeDataId).prepend(
                                    '<div class="laggs" dataid="' + otherIframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
                                );
                            }
                        }
                    });
                }, 300);
            } else {
                clearInterval(loadTimeouts);
            }
        });
    }, options);

    function observeLogamDivs2() {
        document.querySelectorAll('.sessim .octumpro[data-src]').forEach(elem => {
            if (elem instanceof Node) {
                observer3.observe(elem);
            }
        });
    }

    observeLogamDivs2();

    let mutationObserver3 = new MutationObserver((mutations) => {
        mutations.forEach(mutation => {
            mutation.addedNodes.forEach(node => {
                if (node.nodeType === 1) {
                    const iframes = node.querySelectorAll('.sessim .octumpro[data-src]');
                    iframes.forEach(iframe => {
                        if (iframe instanceof Node) {
                            observer3.observe(iframe);

                            // Asignar el src nuevamente si es necesario al volver a observar
                            if (!iframe.src || iframe.src === "") {
                                iframe.src = iframe.getAttribute("data-src");
                                iframe.onload = function() {
                                    $(".laggs[dataid='" + iframe.getAttribute('dataid') + "']").remove();
                                    
                                    // Usar delegación de eventos para el botón .scale3 en el iframe
                                    const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
                                    $(iframeDocument).on('click', '.scale3', function() {
                                        console.log('Clic en el botón .scale3 dentro del iframe con dataid:', iframe.getAttribute('dataid'));
                                        // Aquí puedes agregar la lógica que quieras
                                    });
                                };
                            }
                        }
                    });
                }
            });
        });
    });

    const targetNode = document.querySelector('.moreinfo');
    if (targetNode) {
        mutationObserver3.observe(targetNode, {
            childList: true,
            subtree: true
        });
    }

    // Función para manejar pantalla completa
    function toggleFullScreen(element) {
        if (!document.fullscreenElement) {
            element.requestFullscreen().catch(err => {
                console.error(`Error attempting to enable full-screen mode: ${err.message}`);
            });
        } else {
            if (document.exitFullscreen) {
                document.exitFullscreen();
            }
        }
    }

    // Añade un event listener para el elemento de video para activar fullscreen
    $(".sessim .octumpro[data-src]").on('dblclick', function() {
        toggleFullScreen(this);
    });
});

### Cambios Realizados:

1. Target Específico: Ahora el evento de clic solo se activa en el botón con la clase .scale3.

2. Delegación de Eventos: El código sigue usando delegación para asegurarse de que el evento funcione incluso si el botón se carga dinámicamente.

### Consideraciones:

  • Acceso al Iframe: Este código solo funcionará si el iframe y el documento principal son de la misma fuente (mismo dominio).
  • Asegúrate de que el Botón Exista: Verifica que el botón con la clase .scale3 esté presente en el iframe en el momento de la carga.

Prueba estas implementaciones y, si necesitas más asistencia o ajustes adicionales, ¡házmelo saber!
 
Para asegurarte de que el código detecte clics solo en el botón con la clase .scale3 dentro del iframe, puedes seguir el siguiente enfoque. Aquí tienes el código modificado para enfocarte en ese botón específico:

### Código Modificado:

JavaScript:
$(document).ready(function() {
    const options = {
        root: null,
        threshold: 0.6
    };

    let loadTimeouts;
    let observer3 = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            const dataId = entry.target.getAttribute('dataid');
            const iframe = entry.target;

            if (entry.isIntersecting) {
                // Asignar src si está vacío
                if (!iframe.src || iframe.src === "") {
                    iframe.src = iframe.getAttribute("data-src");
                    iframe.onload = function() {
                        $(".laggs[dataid='" + dataId + "']").remove();

                        // Subscribir al evento de clic en el iframe completo
                        const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;

                        // Usar delegación de eventos para el botón .scale3 en el iframe
                        $(iframeDocument).on('click', '.scale3', function() {
                            console.log('Clic en el botón .scale3 dentro del iframe con dataid:', dataId);
                            // Aquí puedes agregar la lógica que quieras
                        });
                    };
                }

                // Controlar y limpiar src de otros iframes
                loadTimeouts = setInterval(() => {
                    const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
                    iframes.forEach(otherIframe => {
                        const otherIframeDataId = otherIframe.getAttribute("dataid");
                        if (otherIframeDataId !== dataId) {
                            // Comprobar si no existe el elemento .laggs con el dataid correspondiente
                            if ($(".laggs[dataid='" + otherIframeDataId + "']").length === 0) {
                                $(otherIframe).removeAttr('src'); // Eliminar el src de otros iframes

                                // Prepend para agregar mensaje de carga
                                $(".freimps" + otherIframeDataId).prepend(
                                    '<div class="laggs" dataid="' + otherIframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
                                );
                            }
                        }
                    });
                }, 300);
            } else {
                clearInterval(loadTimeouts);
            }
        });
    }, options);

    function observeLogamDivs2() {
        document.querySelectorAll('.sessim .octumpro[data-src]').forEach(elem => {
            if (elem instanceof Node) {
                observer3.observe(elem);
            }
        });
    }

    observeLogamDivs2();

    let mutationObserver3 = new MutationObserver((mutations) => {
        mutations.forEach(mutation => {
            mutation.addedNodes.forEach(node => {
                if (node.nodeType === 1) {
                    const iframes = node.querySelectorAll('.sessim .octumpro[data-src]');
                    iframes.forEach(iframe => {
                        if (iframe instanceof Node) {
                            observer3.observe(iframe);

                            // Asignar el src nuevamente si es necesario al volver a observar
                            if (!iframe.src || iframe.src === "") {
                                iframe.src = iframe.getAttribute("data-src");
                                iframe.onload = function() {
                                    $(".laggs[dataid='" + iframe.getAttribute('dataid') + "']").remove();
                                   
                                    // Usar delegación de eventos para el botón .scale3 en el iframe
                                    const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
                                    $(iframeDocument).on('click', '.scale3', function() {
                                        console.log('Clic en el botón .scale3 dentro del iframe con dataid:', iframe.getAttribute('dataid'));
                                        // Aquí puedes agregar la lógica que quieras
                                    });
                                };
                            }
                        }
                    });
                }
            });
        });
    });

    const targetNode = document.querySelector('.moreinfo');
    if (targetNode) {
        mutationObserver3.observe(targetNode, {
            childList: true,
            subtree: true
        });
    }

    // Función para manejar pantalla completa
    function toggleFullScreen(element) {
        if (!document.fullscreenElement) {
            element.requestFullscreen().catch(err => {
                console.error(`Error attempting to enable full-screen mode: ${err.message}`);
            });
        } else {
            if (document.exitFullscreen) {
                document.exitFullscreen();
            }
        }
    }

    // Añade un event listener para el elemento de video para activar fullscreen
    $(".sessim .octumpro[data-src]").on('dblclick', function() {
        toggleFullScreen(this);
    });
});

### Cambios Realizados:

1. Target Específico: Ahora el evento de clic solo se activa en el botón con la clase .scale3.

2. Delegación de Eventos: El código sigue usando delegación para asegurarse de que el evento funcione incluso si el botón se carga dinámicamente.

### Consideraciones:

  • Acceso al Iframe: Este código solo funcionará si el iframe y el documento principal son de la misma fuente (mismo dominio).
  • Asegúrate de que el Botón Exista: Verifica que el botón con la clase .scale3 esté presente en el iframe en el momento de la carga.

Prueba estas implementaciones y, si necesitas más asistencia o ajustes adicionales, ¡házmelo saber!
$(document).ready(function() {
const options = {
root: null,
threshold: 0.6
};

let loadTimeouts;
let observer3 = new IntersectionObserver((entries) => {
entries.forEach(entry => {
const dataId = entry.target.getAttribute('dataid');
const iframe = entry.target;

if (entry.isIntersecting) {
// Asignar src si está vacío
if (!iframe.src || iframe.src === "") {
iframe.src = iframe.getAttribute("data-src");
iframe.onload = function() {
$(".laggs[dataid='" + dataId + "']").remove();

// Subscribir al evento de clic en el iframe completo
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;

// Usar delegación de eventos para el botón .scale3 en el iframe
$(iframeDocument).on('click', '.scale3', function() {
console.log('Clic en el botón .scale3 dentro del iframe con dataid:', dataId);
// Aquí puedes agregar la lógica que quieras
});
};
}

// Controlar y limpiar src de otros iframes
loadTimeouts = setInterval(() => {
const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
iframes.forEach(otherIframe => {
const otherIframeDataId = otherIframe.getAttribute("dataid");
if (otherIframeDataId !== dataId) {
// Comprobar si no existe el elemento .laggs con el dataid correspondiente
if ($(".laggs[dataid='" + otherIframeDataId + "']").length === 0) {
$(otherIframe).removeAttr('src'); // Eliminar el src de otros iframes

// Prepend para agregar mensaje de carga
$(".freimps" + otherIframeDataId).prepend(
'<div class="laggs" dataid="' + otherIframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
);
}
}
});
}, 300);
} else {
clearInterval(loadTimeouts);
}
});
}, options);

function observeLogamDivs2() {
document.querySelectorAll('.sessim .octumpro[data-src]').forEach(elem => {
if (elem instanceof Node) {
observer3.observe(elem);
}
});
}

observeLogamDivs2();

let mutationObserver3 = new MutationObserver((mutations) => {
mutations.forEach(mutation => {
mutation.addedNodes.forEach(node => {
if (node.nodeType === 1) {
const iframes = node.querySelectorAll('.sessim .octumpro[data-src]');
iframes.forEach(iframe => {
if (iframe instanceof Node) {
observer3.observe(iframe);

// Asignar el src nuevamente si es necesario al volver a observar
if (!iframe.src || iframe.src === "") {
iframe.src = iframe.getAttribute("data-src");
iframe.onload = function() {
$(".laggs[dataid='" + iframe.getAttribute('dataid') + "']").remove();

// Usar delegación de eventos para el botón .scale3 en el iframe
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
$(iframeDocument).on('click', '.scale3', function() {
console.log('Clic en el botón .scale3 dentro del iframe con dataid:', iframe.getAttribute('dataid'));
// Aquí puedes agregar la lógica que quieras
});
};
}
}
});
}
});
});
});

const targetNode = document.querySelector('.moreinfo');
if (targetNode) {
mutationObserver3.observe(targetNode, {
childList: true,
subtree: true
});
}

});

tengo una duda, porque cuando coloco en pantalla grande y lo quito no me coloca el src de nuevo y se queda el lagger?
 
$(document).ready(function() {
const options = {
root: null,
threshold: 0.6
};

let loadTimeouts;
let observer3 = new IntersectionObserver((entries) => {
entries.forEach(entry => {
const dataId = entry.target.getAttribute('dataid');
const iframe = entry.target;

if (entry.isIntersecting) {
// Asignar src si está vacío
if (!iframe.src || iframe.src === "") {
iframe.src = iframe.getAttribute("data-src");
iframe.onload = function() {
$(".laggs[dataid='" + dataId + "']").remove();

// Subscribir al evento de clic en el iframe completo
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;

// Usar delegación de eventos para el botón .scale3 en el iframe
$(iframeDocument).on('click', '.scale3', function() {
console.log('Clic en el botón .scale3 dentro del iframe con dataid:', dataId);
// Aquí puedes agregar la lógica que quieras
});
};
}

// Controlar y limpiar src de otros iframes
loadTimeouts = setInterval(() => {
const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
iframes.forEach(otherIframe => {
const otherIframeDataId = otherIframe.getAttribute("dataid");
if (otherIframeDataId !== dataId) {
// Comprobar si no existe el elemento .laggs con el dataid correspondiente
if ($(".laggs[dataid='" + otherIframeDataId + "']").length === 0) {
$(otherIframe).removeAttr('src'); // Eliminar el src de otros iframes

// Prepend para agregar mensaje de carga
$(".freimps" + otherIframeDataId).prepend(
'<div class="laggs" dataid="' + otherIframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
);
}
}
});
}, 300);
} else {
clearInterval(loadTimeouts);
}
});
}, options);

function observeLogamDivs2() {
document.querySelectorAll('.sessim .octumpro[data-src]').forEach(elem => {
if (elem instanceof Node) {
observer3.observe(elem);
}
});
}

observeLogamDivs2();

let mutationObserver3 = new MutationObserver((mutations) => {
mutations.forEach(mutation => {
mutation.addedNodes.forEach(node => {
if (node.nodeType === 1) {
const iframes = node.querySelectorAll('.sessim .octumpro[data-src]');
iframes.forEach(iframe => {
if (iframe instanceof Node) {
observer3.observe(iframe);

// Asignar el src nuevamente si es necesario al volver a observar
if (!iframe.src || iframe.src === "") {
iframe.src = iframe.getAttribute("data-src");
iframe.onload = function() {
$(".laggs[dataid='" + iframe.getAttribute('dataid') + "']").remove();

// Usar delegación de eventos para el botón .scale3 en el iframe
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
$(iframeDocument).on('click', '.scale3', function() {
console.log('Clic en el botón .scale3 dentro del iframe con dataid:', iframe.getAttribute('dataid'));
// Aquí puedes agregar la lógica que quieras
});
};
}
}
});
}
});
});
});

const targetNode = document.querySelector('.moreinfo');
if (targetNode) {
mutationObserver3.observe(targetNode, {
childList: true,
subtree: true
});
}

});

tengo una duda, porque cuando coloco en pantalla grande y lo quito no me coloca el src de nuevo y se queda el lagger?
La razón por la que el src de tu iframe no se restablece automáticamente al quitar la pantalla grande podría estar relacionada con el hecho de que el evento onload no se activa nuevamente después de salir del modo de pantalla completa.

Aquí tienes una solución que te permitirá asegurarte de que el src se restablezca adecuadamente al salir de pantalla grande y eliminar cualquier mensaje de carga si es necesario.

### Modificaciones para Manejar Salir de Pantalla Completa

1. Escuchar el evento de cambio de pantalla completa para reutilizar el onload o un nuevo evento para manejar la restauración del src.

2. Asegúrate de controlar la visibilidad del iframe y manejar los elementos de carga de manera adecuada.

### Código Modificado:

Aquí tienes un código con estos cambios:

JavaScript:
$(document).ready(function() {
    const options = {
        root: null,
        threshold: 0.6
    };

    let loadTimeouts;
    let observer3 = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            const dataId = entry.target.getAttribute('dataid');
            const iframe = entry.target;

            if (entry.isIntersecting) {
                // Asignar src si está vacío
                if (!iframe.src || iframe.src === "") {
                    iframe.src = iframe.getAttribute("data-src");
                    iframe.onload = function() {
                        $(".laggs[dataid='" + dataId + "']").remove();
                        attachScale3ClickListener(iframe, dataId);
                    };
                }

                // Controlar y limpiar src de otros iframes
                loadTimeouts = setInterval(() => {
                    const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
                    iframes.forEach(otherIframe => {
                        const otherIframeDataId = otherIframe.getAttribute("dataid");
                        if (otherIframeDataId !== dataId) {
                            // Comprobar si no existe el elemento .laggs con el dataid correspondiente
                            if ($(".laggs[dataid='" + otherIframeDataId + "']").length === 0) {
                                $(otherIframe).removeAttr('src'); // Eliminar el src de otros iframes

                                // Prepend para agregar mensaje de carga
                                $(".freimps" + otherIframeDataId).prepend(
                                    '<div class="laggs" dataid="' + otherIframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
                                );
                            }
                        }
                    });
                }, 300);
            } else {
                clearInterval(loadTimeouts);
            }
        });
    }, options);

    function attachScale3ClickListener(iframe, dataId) {
        const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
        
        // Usar delegación de eventos para el botón .scale3 en el iframe
        $(iframeDocument).on('click', '.scale3', function() {
            console.log('Clic en el botón .scale3 dentro del iframe con dataid:', dataId);
            // Aquí puedes agregar la lógica que quieras
        });
    }

    function observeLogamDivs2() {
        document.querySelectorAll('.sessim .octumpro[data-src]').forEach(elem => {
            if (elem instanceof Node) {
                observer3.observe(elem);
            }
        });
    }

    observeLogamDivs2();

    let mutationObserver3 = new MutationObserver((mutations) => {
        mutations.forEach(mutation => {
            mutation.addedNodes.forEach(node => {
                if (node.nodeType === 1) {
                    const iframes = node.querySelectorAll('.sessim .octumpro[data-src]');
                    iframes.forEach(iframe => {
                        if (iframe instanceof Node) {
                            observer3.observe(iframe);

                            // Asignar el src nuevamente si es necesario al volver a observar
                            if (!iframe.src || iframe.src === "") {
                                iframe.src = iframe.getAttribute("data-src");
                                iframe.onload = function() {
                                    $(".laggs[dataid='" + iframe.getAttribute('dataid') + "']").remove();
                                    attachScale3ClickListener(iframe, iframe.getAttribute('dataid'));
                                };
                            }
                        }
                    });
                }
            });
        });
    });

    const targetNode = document.querySelector('.moreinfo');
    if (targetNode) {
        mutationObserver3.observe(targetNode, {
            childList: true,
            subtree: true
        });
    }

    // Manejar el evento de salida de pantalla completa
    document.addEventListener('fullscreenchange', (event) => {
        if (!document.fullscreenElement) {
            // Vuelve a cargar el src, si es necesario, para los iframes visibles
            document.querySelectorAll(".sessim .octumpro[data-src]").forEach(iframe => {
                const dataId = iframe.getAttribute('dataid');
                if (iframe.src === "") { // Verifica solo si el src está vacío
                    iframe.src = iframe.getAttribute("data-src");
                    $(".laggs[dataid='" + dataId + "']").remove();
                }
            });
        }
    });

});

### Cambios Realizados:

1. Función attachScale3ClickListener: Se movió la lógica para agregar el listener al botón .scale3 a una función separada para evitar la repetición.

2. Evento fullscreenchange: Se agregó un listener para el evento fullscreenchange. Este evento se activa cuando se entra o se sale del modo de pantalla completa. En caso de salir, se verifica si el src del iframe está vacío y se establece.

### Consideraciones:

  • Asegúrate de que el iframe y el documento principal sean de la misma fuente (mismo dominio) para que este código funcione correctamente.
  • Revisa que el botón con la clase .scale3 esté presente y sea accesible al momento de agregar el listener.

Prueba estas modificaciones y si necesitas más ayuda, ¡estaré encantado de seguir asistiendo!
 
La razón por la que el src de tu iframe no se restablece automáticamente al quitar la pantalla grande podría estar relacionada con el hecho de que el evento onload no se activa nuevamente después de salir del modo de pantalla completa.

Aquí tienes una solución que te permitirá asegurarte de que el src se restablezca adecuadamente al salir de pantalla grande y eliminar cualquier mensaje de carga si es necesario.

### Modificaciones para Manejar Salir de Pantalla Completa

1. Escuchar el evento de cambio de pantalla completa para reutilizar el onload o un nuevo evento para manejar la restauración del src.

2. Asegúrate de controlar la visibilidad del iframe y manejar los elementos de carga de manera adecuada.

### Código Modificado:

Aquí tienes un código con estos cambios:

JavaScript:
$(document).ready(function() {
    const options = {
        root: null,
        threshold: 0.6
    };

    let loadTimeouts;
    let observer3 = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            const dataId = entry.target.getAttribute('dataid');
            const iframe = entry.target;

            if (entry.isIntersecting) {
                // Asignar src si está vacío
                if (!iframe.src || iframe.src === "") {
                    iframe.src = iframe.getAttribute("data-src");
                    iframe.onload = function() {
                        $(".laggs[dataid='" + dataId + "']").remove();
                        attachScale3ClickListener(iframe, dataId);
                    };
                }

                // Controlar y limpiar src de otros iframes
                loadTimeouts = setInterval(() => {
                    const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
                    iframes.forEach(otherIframe => {
                        const otherIframeDataId = otherIframe.getAttribute("dataid");
                        if (otherIframeDataId !== dataId) {
                            // Comprobar si no existe el elemento .laggs con el dataid correspondiente
                            if ($(".laggs[dataid='" + otherIframeDataId + "']").length === 0) {
                                $(otherIframe).removeAttr('src'); // Eliminar el src de otros iframes

                                // Prepend para agregar mensaje de carga
                                $(".freimps" + otherIframeDataId).prepend(
                                    '<div class="laggs" dataid="' + otherIframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
                                );
                            }
                        }
                    });
                }, 300);
            } else {
                clearInterval(loadTimeouts);
            }
        });
    }, options);

    function attachScale3ClickListener(iframe, dataId) {
        const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
       
        // Usar delegación de eventos para el botón .scale3 en el iframe
        $(iframeDocument).on('click', '.scale3', function() {
            console.log('Clic en el botón .scale3 dentro del iframe con dataid:', dataId);
            // Aquí puedes agregar la lógica que quieras
        });
    }

    function observeLogamDivs2() {
        document.querySelectorAll('.sessim .octumpro[data-src]').forEach(elem => {
            if (elem instanceof Node) {
                observer3.observe(elem);
            }
        });
    }

    observeLogamDivs2();

    let mutationObserver3 = new MutationObserver((mutations) => {
        mutations.forEach(mutation => {
            mutation.addedNodes.forEach(node => {
                if (node.nodeType === 1) {
                    const iframes = node.querySelectorAll('.sessim .octumpro[data-src]');
                    iframes.forEach(iframe => {
                        if (iframe instanceof Node) {
                            observer3.observe(iframe);

                            // Asignar el src nuevamente si es necesario al volver a observar
                            if (!iframe.src || iframe.src === "") {
                                iframe.src = iframe.getAttribute("data-src");
                                iframe.onload = function() {
                                    $(".laggs[dataid='" + iframe.getAttribute('dataid') + "']").remove();
                                    attachScale3ClickListener(iframe, iframe.getAttribute('dataid'));
                                };
                            }
                        }
                    });
                }
            });
        });
    });

    const targetNode = document.querySelector('.moreinfo');
    if (targetNode) {
        mutationObserver3.observe(targetNode, {
            childList: true,
            subtree: true
        });
    }

    // Manejar el evento de salida de pantalla completa
    document.addEventListener('fullscreenchange', (event) => {
        if (!document.fullscreenElement) {
            // Vuelve a cargar el src, si es necesario, para los iframes visibles
            document.querySelectorAll(".sessim .octumpro[data-src]").forEach(iframe => {
                const dataId = iframe.getAttribute('dataid');
                if (iframe.src === "") { // Verifica solo si el src está vacío
                    iframe.src = iframe.getAttribute("data-src");
                    $(".laggs[dataid='" + dataId + "']").remove();
                }
            });
        }
    });

});

### Cambios Realizados:

1. Función attachScale3ClickListener: Se movió la lógica para agregar el listener al botón .scale3 a una función separada para evitar la repetición.

2. Evento fullscreenchange: Se agregó un listener para el evento fullscreenchange. Este evento se activa cuando se entra o se sale del modo de pantalla completa. En caso de salir, se verifica si el src del iframe está vacío y se establece.

### Consideraciones:

  • Asegúrate de que el iframe y el documento principal sean de la misma fuente (mismo dominio) para que este código funcione correctamente.
  • Revisa que el botón con la clase .scale3 esté presente y sea accesible al momento de agregar el listener.

Prueba estas modificaciones y si necesitas más ayuda, ¡estaré encantado de seguir asistiendo!
$(document).ready(function() {
const options = {
root: null,
threshold: 0.6
};

let loadTimeouts;
let observer3 = new IntersectionObserver((entries) => {
entries.forEach(entry => {
const dataId = entry.target.getAttribute('dataid');
const iframe = entry.target;

if (entry.isIntersecting) {
// Asignar src si está vacío
if (!iframe.src || iframe.src === "") {
iframe.src = iframe.getAttribute("data-src");
iframe.onload = function() {
$(".laggs[dataid='" + dataId + "']").remove();
attachScale3ClickListener(iframe, dataId);
};
}

// Controlar y limpiar src de otros iframes
loadTimeouts = setInterval(() => {
const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
iframes.forEach(otherIframe => {
const otherIframeDataId = otherIframe.getAttribute("dataid");
if (otherIframeDataId !== dataId) {
// Comprobar si no existe el elemento .laggs con el dataid correspondiente
if ($(".laggs[dataid='" + otherIframeDataId + "']").length === 0) {
$(otherIframe).removeAttr('src'); // Eliminar el src de otros iframes

// Prepend para agregar mensaje de carga
$(".freimps" + otherIframeDataId).prepend(
'<div class="laggs" dataid="' + otherIframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
);
}
}
});
}, 300);
} else {
clearInterval(loadTimeouts);
}
});
}, options);

function attachScale3ClickListener(iframe, dataId) {
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;

// Usar delegación de eventos para el botón .scale3 en el iframe
$(iframeDocument).on('click', '.scale3', function() {
$("subody").attr("jores",dataId);
// Aquí puedes agregar la lógica que quieras
});
}

function observeLogamDivs2() {
document.querySelectorAll('.sessim .octumpro[data-src]').forEach(elem => {
if (elem instanceof Node) {
observer3.observe(elem);
}
});
}

observeLogamDivs2();

let mutationObserver3 = new MutationObserver((mutations) => {
mutations.forEach(mutation => {
mutation.addedNodes.forEach(node => {
if (node.nodeType === 1) {
const iframes = node.querySelectorAll('.sessim .octumpro[data-src]');
iframes.forEach(iframe => {
if (iframe instanceof Node) {
observer3.observe(iframe);

// Asignar el src nuevamente si es necesario al volver a observar
if (!iframe.src || iframe.src === "") {
iframe.src = iframe.getAttribute("data-src");
iframe.onload = function() {
$(".laggs[dataid='" + iframe.getAttribute('dataid') + "']").remove();
attachScale3ClickListener(iframe, iframe.getAttribute('dataid'));
};
}
}
});
}
});
});
});

const targetNode = document.querySelector('.moreinfo');
if (targetNode) {
mutationObserver3.observe(targetNode, {
childList: true,
subtree: true
});
}

// Manejar el evento de salida de pantalla completa
document.addEventListener('fullscreenchange', (event) => {
if (!document.fullscreenElement) {
// Vuelve a cargar el src, si es necesario, para los iframes visibles
document.querySelectorAll(".sessim .octumpro[data-src]").forEach(iframe => {
const dataId = iframe.getAttribute('dataid');
if (iframe.src === "") { // Verifica solo si el src está vacío
iframe.src = iframe.getAttribute("data-src");
$(".laggs[dataid='" + dataId + "']").remove();
}
});
}
});

});

oks ahora aqui haz que el iframe que tenga el mismo id de jores se quede con el src, que no lo elimine
 
$(document).ready(function() {
const options = {
root: null,
threshold: 0.6
};

let loadTimeouts;
let observer3 = new IntersectionObserver((entries) => {
entries.forEach(entry => {
const dataId = entry.target.getAttribute('dataid');
const iframe = entry.target;

if (entry.isIntersecting) {
// Asignar src si está vacío
if (!iframe.src || iframe.src === "") {
iframe.src = iframe.getAttribute("data-src");
iframe.onload = function() {
$(".laggs[dataid='" + dataId + "']").remove();
attachScale3ClickListener(iframe, dataId);
};
}

// Controlar y limpiar src de otros iframes
loadTimeouts = setInterval(() => {
const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
iframes.forEach(otherIframe => {
const otherIframeDataId = otherIframe.getAttribute("dataid");
if (otherIframeDataId !== dataId) {
// Comprobar si no existe el elemento .laggs con el dataid correspondiente
if ($(".laggs[dataid='" + otherIframeDataId + "']").length === 0) {
$(otherIframe).removeAttr('src'); // Eliminar el src de otros iframes

// Prepend para agregar mensaje de carga
$(".freimps" + otherIframeDataId).prepend(
'<div class="laggs" dataid="' + otherIframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
);
}
}
});
}, 300);
} else {
clearInterval(loadTimeouts);
}
});
}, options);

function attachScale3ClickListener(iframe, dataId) {
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;

// Usar delegación de eventos para el botón .scale3 en el iframe
$(iframeDocument).on('click', '.scale3', function() {
$("subody").attr("jores",dataId);
// Aquí puedes agregar la lógica que quieras
});
}

function observeLogamDivs2() {
document.querySelectorAll('.sessim .octumpro[data-src]').forEach(elem => {
if (elem instanceof Node) {
observer3.observe(elem);
}
});
}

observeLogamDivs2();

let mutationObserver3 = new MutationObserver((mutations) => {
mutations.forEach(mutation => {
mutation.addedNodes.forEach(node => {
if (node.nodeType === 1) {
const iframes = node.querySelectorAll('.sessim .octumpro[data-src]');
iframes.forEach(iframe => {
if (iframe instanceof Node) {
observer3.observe(iframe);

// Asignar el src nuevamente si es necesario al volver a observar
if (!iframe.src || iframe.src === "") {
iframe.src = iframe.getAttribute("data-src");
iframe.onload = function() {
$(".laggs[dataid='" + iframe.getAttribute('dataid') + "']").remove();
attachScale3ClickListener(iframe, iframe.getAttribute('dataid'));
};
}
}
});
}
});
});
});

const targetNode = document.querySelector('.moreinfo');
if (targetNode) {
mutationObserver3.observe(targetNode, {
childList: true,
subtree: true
});
}

// Manejar el evento de salida de pantalla completa
document.addEventListener('fullscreenchange', (event) => {
if (!document.fullscreenElement) {
// Vuelve a cargar el src, si es necesario, para los iframes visibles
document.querySelectorAll(".sessim .octumpro[data-src]").forEach(iframe => {
const dataId = iframe.getAttribute('dataid');
if (iframe.src === "") { // Verifica solo si el src está vacío
iframe.src = iframe.getAttribute("data-src");
$(".laggs[dataid='" + dataId + "']").remove();
}
});
}
});

});

oks ahora aqui haz que el iframe que tenga el mismo id de jores se quede con el src, que no lo elimine
Para modificar el comportamiento de tu código de manera que el iframe cuyo atributo dataid coincida con el valor de jores no elimine su src, puedes agregar una verificación adicional en el bloque que limpia los src de los iframes.

Aquí tienes el código con la modificación necesaria:

### Código Modificado:

JavaScript:
$(document).ready(function() {
    const options = {
        root: null,
        threshold: 0.6
    };

    let loadTimeouts;
    let observer3 = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            const dataId = entry.target.getAttribute('dataid');
            const iframe = entry.target;

            if (entry.isIntersecting) {
                // Asignar src si está vacío
                if (!iframe.src || iframe.src === "") {
                    iframe.src = iframe.getAttribute("data-src");
                    iframe.onload = function() {
                        $(".laggs[dataid='" + dataId + "']").remove();
                        attachScale3ClickListener(iframe, dataId);
                    };
                }

                // Controlar y limpiar src de otros iframes
                loadTimeouts = setInterval(() => {
                    const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
                    iframes.forEach(otherIframe => {
                        const otherIframeDataId = otherIframe.getAttribute("dataid");
                        const currentJores = $("subody").attr("jores"); // Obtener el valor del atributo jores
                        
                        if (otherIframeDataId !== dataId && otherIframeDataId !== currentJores) {
                            // Comprobar si no existe el elemento .laggs con el dataid correspondiente
                            if ($(".laggs[dataid='" + otherIframeDataId + "']").length === 0) {
                                $(otherIframe).removeAttr('src'); // Eliminar el src de otros iframes
                                
                                // Prepend para agregar mensaje de carga
                                $(".freimps" + otherIframeDataId).prepend(
                                    '<div class="laggs" dataid="' + otherIframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
                                );
                            }
                        }
                    });
                }, 300);
            } else {
                clearInterval(loadTimeouts);
            }
        });
    }, options);

    function attachScale3ClickListener(iframe, dataId) {
        const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
        
        // Usar delegación de eventos para el botón .scale3 en el iframe
        $(iframeDocument).on('click', '.scale3', function() {
            $("subody").attr("jores", dataId);
            // Aquí puedes agregar la lógica que quieras
        });
    }

    function observeLogamDivs2() {
        document.querySelectorAll('.sessim .octumpro[data-src]').forEach(elem => {
            if (elem instanceof Node) {
                observer3.observe(elem);
            }
        });
    }

    observeLogamDivs2();

    let mutationObserver3 = new MutationObserver((mutations) => {
        mutations.forEach(mutation => {
            mutation.addedNodes.forEach(node => {
                if (node.nodeType === 1) {
                    const iframes = node.querySelectorAll('.sessim .octumpro[data-src]');
                    iframes.forEach(iframe => {
                        if (iframe instanceof Node) {
                            observer3.observe(iframe);

                            // Asignar el src nuevamente si es necesario al volver a observar
                            if (!iframe.src || iframe.src === "") {
                                iframe.src = iframe.getAttribute("data-src");
                                iframe.onload = function() {
                                    $(".laggs[dataid='" + iframe.getAttribute('dataid') + "']").remove();
                                    attachScale3ClickListener(iframe, iframe.getAttribute('dataid'));
                                };
                            }
                        }
                    });
                }
            });
        });
    });

    const targetNode = document.querySelector('.moreinfo');
    if (targetNode) {
        mutationObserver3.observe(targetNode, {
            childList: true,
            subtree: true
        });
    }

    // Manejar el evento de salida de pantalla completa
    document.addEventListener('fullscreenchange', (event) => {
        if (!document.fullscreenElement) {
            // Vuelve a cargar el src, si es necesario, para los iframes visibles
            document.querySelectorAll(".sessim .octumpro[data-src]").forEach(iframe => {
                const dataId = iframe.getAttribute('dataid');
                if (iframe.src === "") { // Verifica solo si el src está vacío
                    iframe.src = iframe.getAttribute("data-src");
                    $(".laggs[dataid='" + dataId + "']").remove();
                }
            });
        }
    });

});

### Cambios Realizados:

1. Condición Adicional en la Limpieza del src:
- Se agregó una verificación al limpiar los src de los iframes para asegurarse de que el iframe cuyo dataid coincide con el valor de jores no sea eliminado.
- Utiliza const currentJores = $("subody").attr("jores"); para obtener el valor del atributo jores y evitar eliminar el src del iframe correspondiente.

### Consideraciones:

  • Asegúrate de que el elemento subody existe en el DOM y que el atributo jores se esté actualizando correctamente al hacer clic en el botón.
  • Verifica que el iframe tenga el atributo dataid correctamente establecido para que la comparación funcione como se espera.

Con estas modificaciones, el iframe que tenga el mismo dataid que jores no verá su src eliminado. Si necesitas más ayuda, ¡solo házmelo saber!
 
Para modificar el comportamiento de tu código de manera que el iframe cuyo atributo dataid coincida con el valor de jores no elimine su src, puedes agregar una verificación adicional en el bloque que limpia los src de los iframes.

Aquí tienes el código con la modificación necesaria:

### Código Modificado:

JavaScript:
$(document).ready(function() {
    const options = {
        root: null,
        threshold: 0.6
    };

    let loadTimeouts;
    let observer3 = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            const dataId = entry.target.getAttribute('dataid');
            const iframe = entry.target;

            if (entry.isIntersecting) {
                // Asignar src si está vacío
                if (!iframe.src || iframe.src === "") {
                    iframe.src = iframe.getAttribute("data-src");
                    iframe.onload = function() {
                        $(".laggs[dataid='" + dataId + "']").remove();
                        attachScale3ClickListener(iframe, dataId);
                    };
                }

                // Controlar y limpiar src de otros iframes
                loadTimeouts = setInterval(() => {
                    const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
                    iframes.forEach(otherIframe => {
                        const otherIframeDataId = otherIframe.getAttribute("dataid");
                        const currentJores = $("subody").attr("jores"); // Obtener el valor del atributo jores
                       
                        if (otherIframeDataId !== dataId && otherIframeDataId !== currentJores) {
                            // Comprobar si no existe el elemento .laggs con el dataid correspondiente
                            if ($(".laggs[dataid='" + otherIframeDataId + "']").length === 0) {
                                $(otherIframe).removeAttr('src'); // Eliminar el src de otros iframes
                               
                                // Prepend para agregar mensaje de carga
                                $(".freimps" + otherIframeDataId).prepend(
                                    '<div class="laggs" dataid="' + otherIframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
                                );
                            }
                        }
                    });
                }, 300);
            } else {
                clearInterval(loadTimeouts);
            }
        });
    }, options);

    function attachScale3ClickListener(iframe, dataId) {
        const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
       
        // Usar delegación de eventos para el botón .scale3 en el iframe
        $(iframeDocument).on('click', '.scale3', function() {
            $("subody").attr("jores", dataId);
            // Aquí puedes agregar la lógica que quieras
        });
    }

    function observeLogamDivs2() {
        document.querySelectorAll('.sessim .octumpro[data-src]').forEach(elem => {
            if (elem instanceof Node) {
                observer3.observe(elem);
            }
        });
    }

    observeLogamDivs2();

    let mutationObserver3 = new MutationObserver((mutations) => {
        mutations.forEach(mutation => {
            mutation.addedNodes.forEach(node => {
                if (node.nodeType === 1) {
                    const iframes = node.querySelectorAll('.sessim .octumpro[data-src]');
                    iframes.forEach(iframe => {
                        if (iframe instanceof Node) {
                            observer3.observe(iframe);

                            // Asignar el src nuevamente si es necesario al volver a observar
                            if (!iframe.src || iframe.src === "") {
                                iframe.src = iframe.getAttribute("data-src");
                                iframe.onload = function() {
                                    $(".laggs[dataid='" + iframe.getAttribute('dataid') + "']").remove();
                                    attachScale3ClickListener(iframe, iframe.getAttribute('dataid'));
                                };
                            }
                        }
                    });
                }
            });
        });
    });

    const targetNode = document.querySelector('.moreinfo');
    if (targetNode) {
        mutationObserver3.observe(targetNode, {
            childList: true,
            subtree: true
        });
    }

    // Manejar el evento de salida de pantalla completa
    document.addEventListener('fullscreenchange', (event) => {
        if (!document.fullscreenElement) {
            // Vuelve a cargar el src, si es necesario, para los iframes visibles
            document.querySelectorAll(".sessim .octumpro[data-src]").forEach(iframe => {
                const dataId = iframe.getAttribute('dataid');
                if (iframe.src === "") { // Verifica solo si el src está vacío
                    iframe.src = iframe.getAttribute("data-src");
                    $(".laggs[dataid='" + dataId + "']").remove();
                }
            });
        }
    });

});

### Cambios Realizados:

1. Condición Adicional en la Limpieza del src:
- Se agregó una verificación al limpiar los src de los iframes para asegurarse de que el iframe cuyo dataid coincide con el valor de jores no sea eliminado.
- Utiliza const currentJores = $("subody").attr("jores"); para obtener el valor del atributo jores y evitar eliminar el src del iframe correspondiente.

### Consideraciones:

  • Asegúrate de que el elemento subody existe en el DOM y que el atributo jores se esté actualizando correctamente al hacer clic en el botón.
  • Verifica que el iframe tenga el atributo dataid correctamente establecido para que la comparación funcione como se espera.

Con estas modificaciones, el iframe que tenga el mismo dataid que jores no verá su src eliminado. Si necesitas más ayuda, ¡solo házmelo saber!
oks ahora hazme un codigo para cuando salga del full screen se elimine el atributo jores
 
oks ahora hazme un codigo para cuando salga del full screen se elimine el atributo jores
Para eliminar el atributo jores del elemento subody cuando se sale del modo de pantalla completa, simplemente puedes agregar una línea de código en el manejador del evento fullscreenchange. Aquí tienes el código modificado para incluir esta funcionalidad:

### Código Modificado:

JavaScript:
$(document).ready(function() {
    const options = {
        root: null,
        threshold: 0.6
    };

    let loadTimeouts;
    let observer3 = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            const dataId = entry.target.getAttribute('dataid');
            const iframe = entry.target;

            if (entry.isIntersecting) {
                // Asignar src si está vacío
                if (!iframe.src || iframe.src === "") {
                    iframe.src = iframe.getAttribute("data-src");
                    iframe.onload = function() {
                        $(".laggs[dataid='" + dataId + "']").remove();
                        attachScale3ClickListener(iframe, dataId);
                    };
                }

                // Controlar y limpiar src de otros iframes
                loadTimeouts = setInterval(() => {
                    const iframes = document.querySelectorAll(".sessim .octumpro[data-src]");
                    iframes.forEach(otherIframe => {
                        const otherIframeDataId = otherIframe.getAttribute("dataid");
                        const currentJores = $("subody").attr("jores"); // Obtener el valor del atributo jores
                        
                        if (otherIframeDataId !== dataId && otherIframeDataId !== currentJores) {
                            // Comprobar si no existe el elemento .laggs con el dataid correspondiente
                            if ($(".laggs[dataid='" + otherIframeDataId + "']").length === 0) {
                                $(otherIframe).removeAttr('src'); // Eliminar el src de otros iframes
                               
                                // Prepend para agregar mensaje de carga
                                $(".freimps" + otherIframeDataId).prepend(
                                    '<div class="laggs" dataid="' + otherIframeDataId + '" style="margin-left:10px;display:flex;justify-content:center;justify-items:center;align-content:center;align-items:center;background:#000000;width:calc(100% - 20px);height:100%;float:left;z-index:1;position:absolute;"><img src="../wpp/img/loading-25.gif" loading="lazy" style="width:20px;height:20px;" /></div>'
                                );
                            }
                        }
                    });
                }, 300);
            } else {
                clearInterval(loadTimeouts);
            }
        });
    }, options);

    function attachScale3ClickListener(iframe, dataId) {
        const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
       
        // Usar delegación de eventos para el botón .scale3 en el iframe
        $(iframeDocument).on('click', '.scale3', function() {
            $("subody").attr("jores", dataId);
            // Aquí puedes agregar la lógica que quieras
        });
    }

    function observeLogamDivs2() {
        document.querySelectorAll('.sessim .octumpro[data-src]').forEach(elem => {
            if (elem instanceof Node) {
                observer3.observe(elem);
            }
        });
    }

    observeLogamDivs2();

    let mutationObserver3 = new MutationObserver((mutations) => {
        mutations.forEach(mutation => {
            mutation.addedNodes.forEach(node => {
                if (node.nodeType === 1) {
                    const iframes = node.querySelectorAll('.sessim .octumpro[data-src]');
                    iframes.forEach(iframe => {
                        if (iframe instanceof Node) {
                            observer3.observe(iframe);

                            // Asignar el src nuevamente si es necesario al volver a observar
                            if (!iframe.src || iframe.src === "") {
                                iframe.src = iframe.getAttribute("data-src");
                                iframe.onload = function() {
                                    $(".laggs[dataid='" + iframe.getAttribute('dataid') + "']").remove();
                                    attachScale3ClickListener(iframe, iframe.getAttribute('dataid'));
                                };
                            }
                        }
                    });
                }
            });
        });
    });

    const targetNode = document.querySelector('.moreinfo');
    if (targetNode) {
        mutationObserver3.observe(targetNode, {
            childList: true,
            subtree: true
        });
    }

    // Manejar el evento de salida de pantalla completa
    document.addEventListener('fullscreenchange', (event) => {
        if (!document.fullscreenElement) {
            // Vuelve a cargar el src, si es necesario, para los iframes visibles
            document.querySelectorAll(".sessim .octumpro[data-src]").forEach(iframe => {
                const dataId = iframe.getAttribute('dataid');
                if (iframe.src === "") { // Verifica solo si el src está vacío
                    iframe.src = iframe.getAttribute("data-src");
                    $(".laggs[dataid='" + dataId + "']").remove();
                }
            });

            // Eliminar el atributo jores del subbody
            $("subody").removeAttr("jores");
        }
    });

});

### Cambios Realizados:

1. Eliminación del Atributo jores: Se ha añadido la línea $("subody").removeAttr("jores"); dentro del bloque del evento fullscreenchange, que se ejecutará cuando dejes el modo de pantalla completa.

### Consideraciones:

  • Asegúrate de que el elemento subody exista en el DOM y que el atributo jores se aplique correctamente en otras partes de tu código.
  • Estos cambios garantizarán que cada vez que salgas de pantalla completa, se elimine el atributo jores del elemento subody.

Si necesitas más ayuda o ajustes adicionales, ¡házmelo saber!
 
Estado

🔒 Este tema está cerrado para nuevas respuestas.

⏰ Solo el creador del tema puede solicitar la reapertura de sus propios temas, pero únicamente dentro de los 60 días previos a la última actualización.

Temas similares

Atrás
Arriba