Solved

Site fades as video comes on. Then click to get site back. Client doesn't like it.

Posted on 2013-12-03
12
477 Views
Last Modified: 2013-12-07
rockypointendoscopy.com/cirrhosis.html

Hi- you'll see on the video that the site fades to grey a little(as client requested). Then, when you close the video, you have to click twice to get the site to come back from grey.

The client doesn't like that, he wants it to come back from grey when the video is closed. Is there a way to do that within the framework I have? Thanks.
0
Comment
Question by:mel200
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 18

Expert Comment

by:Steven Harris
ID: 39693185
You can manually trigger a close event by calling .trigger('close') on the element you have lightboxed.

$ele.lightbox_me();
$ele.trigger('close');

Or you can use the closeClick option.
0
 

Author Comment

by:mel200
ID: 39693204
Thanks- you're going to have to hold my hand a little more, though. :)

Where would either of those go in the code? Thanks.
0
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39693210
You should be able to use player ended

https://developers.google.com/youtube/js_api_reference#Adding_event_listener and on ended you would call the close function of your modal.  

Events

onStateChange
This event fires whenever the player's state changes. The value that the API passes to your event listener function will specify an integer that corresponds to the new player state. Possible values are:
-1 (unstarted)
0 (ended)
1 (playing)
2 (paused)
3 (buffering)
5 (video cued).
When the player first loads a video, it will broadcast an unstarted (-1) event. When a video is cued and ready to play, the player will broadcast a video cued (5) event. In your code, you can specify the integer values or you can use one of the following namespaced variables:
YT.PlayerState.ENDED
YT.PlayerState.PLAYING
YT.PlayerState.PAUSED
YT.PlayerState.BUFFERING
YT.PlayerState.CUED


Are you using bootstrap's modal? http://getbootstrap.com/javascript/#modals  If you are, then you would call $('#myModal').modal('hide') once you detect the movie is over via the event listner
0
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 

Author Comment

by:mel200
ID: 39693261
Thanks, padas, I'm pretty green at this, so I don't really understand how to use what you posted, although it sounds right..
0
 
LVL 15

Expert Comment

by:jorge_toriz
ID: 39702444
On your cirrhosis.html file, change this code:

    <script>
        $(function () {
            $('.youtube').click(function (e) {
                $('#video_container').lightbox_me({
                    centered: true
                });
                e.preventDefault();
            });
        })
        $('.youtube').click(function (e) {
            $('#video_container').lightbox_me({
                centered: true,
                opacity: .5,
                onClose: function () { alert('Sopas'); }
            });
            e.preventDefault();
        });
    </script>

Open in new window


By this one
    <script>
        $(function () {
            $('.youtube').click(function (e) {
                $('#video_container').lightbox_me({
                    centered: true
                });
                e.preventDefault();
            });
        })
        /*$('.youtube').click(function (e) {
            $('#video_container').lightbox_me({
                centered: true,
                opacity: .5,
                onClose: function () { alert('Sopas'); }
            });
            e.preventDefault();
        });*/
    </script>

Open in new window

And in jquery.lightbox_me.js change this code:
$self.delegate(opts.closeSelector, "click", function(e) {
            closeLightbox(); e.preventDefault();
            });

Open in new window

By this one:
$(opts.closeSelector).click(function (e) {
                closeLightbox();
                e.preventDefault();
            });

Open in new window

0
 

Author Comment

by:mel200
ID: 39702471
Thanks, I'll try that right now!
0
 

Author Comment

by:mel200
ID: 39702482
Better- but I still have to click once on the page to get it back...is there a way to have the page come back on close? So click close, the page is available? Thanks a lot for your help!
0
 
LVL 15

Expert Comment

by:jorge_toriz
ID: 39702552
Mmm... weird, can you refresh your cache?, I think your browser is using the previous version of the js file.
0
 

Author Comment

by:mel200
ID: 39702678
I cleared my cache, and also tried it on internet explorer, which I'd never had this site on. Same thing, have to click on the site to bring it back. If I look at source, then the js file, I see the correct change on that file.
0
 
LVL 15

Accepted Solution

by:
jorge_toriz earned 500 total points
ID: 39702751
Ups, sorry, I forgot another change, this is the current code:
<div onclick="yt_hide()">

Open in new window

And must be changed by this one:
<div onclick="yt_hide()" class="close">

Open in new window

0
 

Author Closing Comment

by:mel200
ID: 39703169
Thanks so much! Works perfectly!
0

Featured Post

Linux Academy Android App Now Supports Chromecast

We have some fantastic news for our Android fans. We’re so excited to announce that the Linux Academy Android app is now available with Chromecast support. That’s right – simply download the latest update of the Linux Academy App and start casting your favorite course videos!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question