Hello!
I'm trying to do a window plugin with jQuery, but I have a serious
problem. My code is based on the UI jQuery Dialog, but I need to
imlement the windows with canvas and a lot of functions.
I call my function: $j('<iframe src="http://
www.google.es/').ventana(), for example.
(function($j){
$j.fn.ventana = function(opciones){
var o = $j.extend({}, $j.fn.ventana.defaults, opciones);
return this.each(function(){
if (!($j(this).parent(".ventana").length ||
$j(el).is(".ventana"))){
$j.fn.ventana.crearEstructura(this,o);
}
$j.fn.ventana.abrirVentana(this);
});
};
$j.fn.ventana.crearEstructura = function(contenido,o){
if ($j(contenido).parent().length){
contenido = $j(contenido).html();
contenido.remove();
}else{
contenido = $j(contenido).wrap('<div class="auxiliar"></
div>').html();
}
And all go well. BUT! When I call my function $j('<div class="prueba"/
>).ventana(), and that div isn't in the DOM, when I question in my
code:
¿$j(contenido).parent().length?
jQuery say YES!!! Why??? I use Firebug and when I put on the console
$j(contenido).parent() returns [div]. ¿div? There isn't any div,
what's happening? Help please!