Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6023959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:05:03+00:00 2026-05-23T04:05:03+00:00

This should be fairly straight forward but is proving not to be. I want

  • 0

This should be fairly straight forward but is proving not to be. I want (my client wants) a pop up lightbox window with an embedded youtube video to appear as soon as the page is loaded and then for it to disappear when the video has finished. I was struggling to make one of the normal lightboxes pop up on page load so managed to get the following working:

$(document).ready(function() {  

//Put in the DIV id you want to display
launchWindow('#dialog1');

//if close button is clicked
$('.window #close').click(function () {
    $('#mask').hide();
    $('.window').hide();
});     

//if mask is clicked
$('#mask').click(function () {
    $(this).hide();
    $('.window').hide();
}); 

    $("#mask").delay(24000).hide();
    $(".window").delay(24000).hide();

});

function launchWindow(id) {

    //Get the screen height and width
    var maskHeight = $(document).height();
    var maskWidth = $(window).width();

    //Set heigth and width to mask to fill up the whole screen
    $('#mask').css({'width':maskWidth,'height':maskHeight});

    //transition effect     
    $('#mask').fadeIn(1000);    
    $('#mask').fadeTo("slow",0.8);  

    //Get the window height and width
    var winH = $(window).height();
    var winW = $(window).width();

    //Set the popup window to center
    $(id).css('top',  winH/2-$(id).height());
    $(id).css('left', winW/2-$(id).width()/2);

    //transition effect
    $(id).fadeIn(2000); 

}



<div id="boxes">
    <div id="dialog1" class="window">
        <iframe width="725" height="442" src="http://www.youtube.com/embed/SMlRXI_N6u4?autoplay=1" frameborder="0" allowfullscreen id="youtube-popup"></iframe>
    </div>
</div>

<div id="mask"></div> 

Which works fine in terms of it popping up. Then the

   $("#mask").delay(24000).hide();
   $(".window").delay(24000).hide();

commands should be hiding the two overlays after 24 seconds (the length of the video). However their presence anywhere in the piece causes it not to pop up at all, let alone disappear after 24 seconds.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:05:04+00:00Added an answer on May 23, 2026 at 4:05 am

    .hide() with no duration does not get added to the queue, it executes immediately. The easiest trick would be to change it to .hide(1).

    Other possibilities although slightly more work would be to use setTimeout or enqueue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems like it should be fairly straight-forward, but I can't see anything obvious.
So this should be a fairly straight forward trigger, but my MySQL isn't great,
This should be a fairly straight forward python question, but I'm getting stuck getting
This is a fairly straight forward question but I'm having a problem finding a
There probably is a fairly simple and straight-forward answer for this, but for some
This should be a fairly simple question to answer, but I am interested to
I'm fairly sure there should be an elegant solution to this (in MATLAB), but
This should be a fairly straightforward question, but I haven't been able to find
This should be a fairly common question, but I haven't found a straightforward answer
This should seem to be a fairly straightforward question, but I'm struggling a bit.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.