• Please note that this section is for questions regarding the forum itself - it is not for fan game-related questions. If you have a question about a fan game, ask in the appropriate thread.

  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Akari, Red, Kris, May - which Pokémon protagonist is your favorite? Let us know by voting in our semifinal favorite protagonist poll!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Issue: Videos continue to play in a spoiler when hidden

  • 7
    Posts
    12
    Years
    • Seen May 16, 2025
    In my mind, when you hide a spoiler, it should stop the video playing

    this can be achieved with the following simple code

    JavaScript:
    window.addEventListener("click",e=>{
        var t=e.target;
        if (t.matches(".spoiler-block input.button")){
            if (t.value.split(" ")[0]==="Show"){
                [...t.closest(".spoiler-block").querySelectorAll("iframe")].forEach(f=>{
                    var oS = f.src;
                    f.src="";
                    f.src=oS;
                })
            }
        }
    });
     
    Back
    Top