Title: Auto Close
Last modified: August 30, 2016

---

# Auto Close

 *  Resolved [jahangeerm](https://wordpress.org/support/users/jahangeerm/)
 * (@jahangeerm)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/auto-close-3/)
 * Hi,
    Thank you for the beautiful plugin. I would like the popup to close automatically
   after the video ends. Is this possible? And it is showing up on my blog page 
   even though I specified to only appear on home page. Has anyone found a solution
   for this yet?
 * [https://wordpress.org/plugins/simple-popup-manager/](https://wordpress.org/plugins/simple-popup-manager/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [jahangeerm](https://wordpress.org/support/users/jahangeerm/)
 * (@jahangeerm)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/auto-close-3/#post-6546227)
 * Does anyone know how I can stop this plugin from showing up in on my Post Page.
   I want it only on my home page.
 *  Plugin Author [MB Creation](https://wordpress.org/support/users/mbcreation/)
 * (@mbcreation)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/auto-close-3/#post-6546357)
 * Hi, here is what you need to put in the editor in order to show a video that 
   will close the popup at the end. Replace XXXXXXXX by your youtube id.
 * Have a good day.
 *     ```
       <div id="player"></div>
   
       <script type="text/javascript">// <![CDATA[
           //Load player api asynchronously.
           var tag = document.createElement('script');
           tag.src = "//www.youtube.com/iframe_api";
           var firstScriptTag = document.getElementsByTagName('script')[0];
           firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
           var done = false;
           var player;
           function onYouTubeIframeAPIReady() {
               player = new YT.Player('player', {
                 height: '360',
                 width: '640',
                 videoId: 'XXXXXXXX',
                 events: {
                   'onReady': onPlayerReady,
                   'onStateChange': onPlayerStateChange
                 }
               });
           }
           function onPlayerReady(evt) {
               evt.target.playVideo();
           }
           function onPlayerStateChange(evt) {
               if (evt.data == YT.PlayerState.ENDED && !done) {
                   document.getElementById('spmCloseButton').click();
                   done = true;
               }
           }
       // ]]></script>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Auto Close’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/simple-popup-manager.svg)
 * [Simple Popup Manager](https://wordpress.org/plugins/simple-popup-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-popup-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-popup-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-popup-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-popup-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-popup-manager/reviews/)

## Tags

 * [auto-close](https://wordpress.org/support/topic-tag/auto-close/)

 * 2 replies
 * 2 participants
 * Last reply from: [MB Creation](https://wordpress.org/support/users/mbcreation/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/auto-close-3/#post-6546357)
 * Status: resolved