So my problem is that fancybox wont work till 2nd click :/ i have no idea why :/ i added a live event but still nothing its really weird.
heres my code
galeria is running on the document ready function
function galeria() {
$("#content").load(Lugar +'/Galeria #content',function() {
$(".inscripciones").css('color', '#90D3CB');
$(".nosotros").css('color', '#90D3CB');
$(".programas").css('color', '#90D3CB');
$(".servicios").css('color', '#90D3CB');
$(".inicio").css('color', '#90D3CB');
$(".noticias").css('color', '#90D3CB');
$(".contacto").css('color', '#90D3CB');
$(".galeria").css('color', '#FCF8F6');
$("#cargaContenido").html("");
$(".caja p a").attr('rel', 'cajita')
$( '.container' ).children().show();
$(".Portafolio").addClass('oversubmenu')
$("#loader").hide();
columnas();
hoverli();
focusli();
taller();
instalaciones();
portafolio();
hovernav();
siguientebloque();
antesbloque();
box();
});
}
function box(){
$(".caja p a").attr("rel","cajita").live('click', function() {
/*$this = $(this);
$.fancybox({
href: $this.attr('href'),
});*/
$(".caja p a").attr("rel","cajita").fancybox({
});
return false;
});
}
Are you trying to assign the handler to the link with attribute
rel="cajita"? What you are really doing is assigning that attribute to the link.And why are you calling your fancybox in a click handler? Fancybox should apply the click handler for you:
This will probably fix your problem.