I am trying to use the jquery .load function, replacing .click. Because the intention is for the lightbox to open while loading the page and not clicking.
JS TO OPEN THE MODAL WINDOW BY CLICKING ON A LINK
$(document).ready(function(){
$("a[rel=modal]").click( function(ev){
ev.preventDefault();
var id = $(this).attr("href");
var alturaTela = $(document).height();
var larguraTela = $(window).width();
//colocando o fundo preto
$('#mascara').css({'width':larguraTela,'height':alturaTela});
$('#mascara').fadeIn(1000);
$('#mascara').fadeTo("slow",0.8);
var left = ($(window).width() /2) - ( $(id).width() / 2 );
var top = ($(window).height() / 3) - ( $(id).height() / 3 );
$(id).css({'top':top,'left':left});
$(id).show();
});
$("#mascara").load( function(){
$(this).hide();
$(".janelao").hide();
});
$('.fechar').click(function(ev){
ev.preventDefault();
$("#mascara").hide();
$(".window").hide();
});
});
JS TO OPEN MODAL WINDOW WITH PAGE LOADING
In this part I changed the $ ("a [rel = modal]"). click for $ (window) .load and it ROUGH! But it only opens the black background and not the div #janelao
$(document).ready(function(){
$(window).load( function(ev){
ev.preventDefault();
>
$("#mascara").load( function(){
$(this).show();
$(".janelao").show();
});
So my problem is to load the window div that does not load, just load the black background