You will recieve your password to this address. Address is not made public.

Your preferred username that is used when logging in.

How can I close an overlay in a function? Created Aug 22, 2010

This thread is solved

Views: 2408     Replies: 6     Last reply Oct 18, 2010  
You must login first before you can use this feature

thepixelprodigy

Posts: 2

Registered:
Jul 28, 2010

How can I close an overlay in a function?

Posted: Aug 22, 2010

Hey guys,
I have been struggling with this for a while. At the end of an ajax call I am trying to have the expose+overlay close. For instance using:


$('#submit').click(function(){
  //all the ajax stuff here
  $(this).overlay().close();
});

Does not work. I am sure this is a call, just cant seem to find the documentation anywhere on the site. Any ideas?

Thanks!

Christian Ebert
Flowplayer support

Posts: 2803

Registered:
May 27, 2008

» How can I close an overlay in a function?

Posted: Aug 26, 2010

Reply to: How can I close an overlay in a function?, from thepixelprodigy
Is the overlay really installed in the #submit element? It seems to me that you might have to do something like:


$("#submit").click(function () {
  // assuming overlay is installed in element with id="overlay"
  $("#overlay").data("overlay").close();
});

$("#overlay").overlay().close() should also work, but jQuery's data method is recommended and perhaps cleaner.

chris_kal

Posts: 3

Registered:
Sep 10, 2010

Problem with closing several times

Posted: Sep 10, 2010

Reply to: » How can I close an overlay in a function?, from blacktrash
Hi, I tried this approach:

$("#overlay").data("overlay").close();

and it works. But when I reopen the overlay and try to close it again with the same approach it doesn't work (it doesn't close the overlay).

When I call the isOpen() method after reopening it delivers false although I can see the overlay (when I first open the overlay isOpen() delivers true).

Does anyone know how to solve this problem?

Christian Ebert
Flowplayer support

Posts: 2803

Registered:
May 27, 2008

» Problem with closing several times

Posted: Sep 10, 2010

Reply to: Problem with closing several times, from chris_kal
There must be something else interfering; works alright in this little demo with 2 overlays:

http://www.blacktrash.org/test/overlay-minimal.html


$(document).ready(function() {
  $("img[rel]").overlay();

  $("button").eq(0).click(function () {
    $("img[rel]").each(function () {
      var ol = $(this).data("overlay");
      if (ol.isOpened()) {
        ol.close();
      }
    });
  });
});

voldy

Posts: 1

Registered:
Sep 20, 2010

» » Problem with closing several times

Posted: Sep 20, 2010

Reply to: » Problem with closing several times, from blacktrash
blacktrash,
thanks! That works pretty nice.

dude76

Posts: 1

Registered:
Sep 21, 2010

close the overlay - inside

Posted: Sep 21, 2010

Reply to: How can I close an overlay in a function?, from thepixelprodigy
hello,

i used the overlay function.

but i have problem with a close button > inside the overlay <.

i dont know how it works. all solutions i read about
> outside closing < and the css class ".close" doesnt work.

who can help?

i tried with this unfine solution:

document.getElementById('exposeMask').style.display = "none";
document.getElementById('overlay').style.display = "none";
document.getElementById('contentWrap').style.display = "none";

but the background image doesnt closed!!!

info: in my overlay no relations to any jquery functions (js)
only css files!

lathamb

Posts: 3

Registered:
Feb 3, 2010

Foolproof way

Posted: Oct 18, 2010

Reply to: How can I close an overlay in a function?, from thepixelprodigy
Hey guys,

if anyone is like me and none of the above solutions worked.

I figured out a fool proof way that should work for any circumstance:



$('.close').live('click', function() {
        
        $("#videoOverlay").fadeOut('slow', function() {
           
          });

        $("#exposeMask").fadeOut('slow', function() {
            
          });

    });

The .live will allow this to work with any close object whether it was dynamically created or like me, hardcoded into the overlay.

Hope it helps!