/    Sign up×
Community /Pin to ProfileBookmark

Trigger / Display div after video ends

Hello,
I am having a problem and I hope you can help me. I have a video running on a page and after it finishes I want to trigger a div that contains a slide. Here’s the code I am using to detect when the video ended and to display the div but i must be doing something wrong ( don’t know my way around javascript at all )

`<script type=’text/javascript’>
document.getElementById(‘video1’).addEventListener(‘ended’,displaydiv,false);
function displaydiv(e) {
$(“#slide1”)
</script>`

And here is the div i want to trigger after the video has finished:

`<div id=”slide1″ class=”slide”></div>
`

Would appreciate your help so much,
Thank you!

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumFeb 22.2020 — You don't execute any action for that div. Try this:

`$("#slide1").css('display', 'block');`
Copy linkTweet thisAlerts:
@StudioWorksauthorFeb 23.2020 — @Sempervivum#1615110 Hey, Thanks so much for your input. I added what you suggested but nothing happens after the video has finished playing.
Copy linkTweet thisAlerts:
@SempervivumFeb 23.2020 — 
  • 1. This code makes the div visible. In order to get an effect you need to make it invisible first, e. g. by this CSS:
    &lt;style&gt;
    #slide1 {
    display: none;
    }
    &lt;/style&gt;

  • 2. `$("#slide1")</C> needs jQuery, did you include it? You can do without easily by using this code instead:<br/>
    <C>
    document.getElementById("slide1').style.display = 'block';`
  • ×

    Success!

    Help @StudioWorks spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 4.26,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,

    tipper: @Samric24,
    tipped: article
    amount: 1000 SATS,
    )...