April 26, 2012

need help to figure out what is the error, it's jQuery code

Question by user1743638

i’m trying to make something like light box for a message with jQuery and CSS
but it doesn’t work!!!
here is jQuery code

$(document).ready(function(e) {

    function myFunction(){
        $("#overLay").hide();
        $("#x").hide();
        $("#message").hide();
    }

    $("#overLay").click( myFunction() );
    $("#x").click( myFunction() );

});

Answer by muffel

function myFunction(){
    $("#overLay").hide();
    $("#x").hide();
    $("#message").hide();
}
$(function(){ //run after page is loaded
   $("#overLay").click(myFunction);
   $("#x").click(myFunction);
});

Answer by Starx

As for the syntactical part, The way you are calling the functions are wrong, call them without the parenthesis

$("#overLay").click( myFunction );
$("#x").click( myFunction );
March 23, 2011

Can one display an entire unmodified website on top of another one in a lightbox?

Question by alumanimac

Is it possible to do this with just javascript/jquery/ajax?
The idea is to make another website display unmodified i.e. display the pure html of the site in a view that hovers over the current view like a lightbox as opposed to in a new window or tab as one usually has in a browser.

Any descriptions, examples, or basic to advanced tutorials and books would be helpful here.

Thanks!

Answer by Starx

IF you want the completely usmodified version, the easiest way is to go with is <iframe>

Example:

<iframe src="http://www.google.com"></iframe>

If you are looking for a lightbox capable of showing iframe or html, here is a list (Thanks to JohnP) http://planetozh.com/projects/lightbox-clones/

...

Please fill the form - I will response as fast as I can!