Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/06/2012, 22:56
nitsuga1986
 
Fecha de Ingreso: octubre-2008
Mensajes: 91
Antigüedad: 15 años, 7 meses
Puntos: 0
Fallo de Jquery al cargar AJAX

Buenos dias, estoy usando JQuery para hacer una ventana modal, el caso es que uso este codigo:



$(document).ready(function() {
$('a[name=modal]').click(function(e) {

//Cancel the link behavior
e.preventDefault();

//Get the A tag
var id = $(this).attr('href');

//Get the screen height and width
var maskHeight = $(document).height();
var maskWidth = $(window).width();

//Set heigth and width to mask to fill up the whole screen
$('#mask').css({'width':maskWidth,'height':maskHei ght});

//transition effect
$('#mask').fadeIn(500);
$('#mask').fadeTo("slow",0.9);

//Get the window height and width
var winH = $(window).height();
var winW = $(window).width();

//Set the popup window to center
//$(id).css('top', winH/2-$(id).outerHeight()/2);
$(id).css('top', 20);
$(id).css('left', winW/2-$(id).outerWidth()/2);

//window.location.hash = "#inicio";

//transition effect
$(id).fadeIn(500);

});

});


Es un codigo simple que lo unico que hace es detectar cuando hago click en un tag a con clase='modal',
<a href="#dialog_opciones" name="modal"></a>

el caso es que si mediante AJAX hago una peticion al server y me devuelve un enlace igual que el anterior, no funciona...no lo detecta, sin en cambio el anterior lo sigue detectando...

Sabeis porque jquery no detecta los tag cuando son cargados por Ajax?

Gracias por adelantado