GithubHelp home page GithubHelp logo

Comments (1)

Daveke7 avatar Daveke7 commented on June 16, 2024

I fixed it, for anyone who would like to know how. This is how I did it.


var audio1 = document.getElementById("audio1");
var audio2 = document.getElementById("audio2");
var audio3 = document.getElementById("audio3");
var audio4 = document.getElementById("audio4");
var player1 = document.getElementById("article-video1");
var player2 = document.getElementById("article-video2");
var player3 = document.getElementById("article-video3");
var player4 = document.getElementById("article-video-2");
var player5 = document.getElementById("article-video-3");

function playMary() {
    audio1.play();
}

function playNancy() {
    audio2.play();
}

function playJames() {
    audio3.play();
}

function playJohn() {
    audio4.play();
}

$(document).on('click.modal', 'a[rel~="modal:open"]', function(event) {
    player1.play(); // Stop playing
    player2.play(); // Stop playing
    player3.play(); // Stop playing
    player4.play(); // Stop playing
    player5.play(); // Stop playing
});

$(document).on('click.modal', 'a[rel~="modal:close"]', function(event) {
    if (audio1) {
        audio1.pause(); // Stop playing
        audio1.currentTime = 0; // Reset time,
    } else if(audio2){
        audio2.pause(); // Stop playing
        audio2.currentTime = 0; // Reset time
    } else if(audio3){
        audio3.pause(); // Stop playing
        audio3.currentTime = 0; // Reset time
    } else if(audio4) {
        audio4.pause(); // Stop playing
        audio4.currentTime = 0; // Reset time
    } else if (myPlayer){
        myPlayer.pause(); // Stop playing
        myPlayer.currentTime = 0; // Reset time
    }
    
    player1.pause(); // Stop playing
    player2.pause(); // Stop playing
    player3.pause(); // Stop playing
    player4.pause(); // Stop playing
    player5.pause(); // Stop playing
    console.log(myPlayer);
});

from jquery-modal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.