this is how they defined the lightbox at work
$(".lightbox873x560").colorbox({width:"845", height:"555", resize:false, iframe:true, scrolling:"no", opacity:"0.65"});
$(".lightboxGallery").colorbox({width:"845", height:"555", resize:false, iframe:true, scrolling:"no", opacity:"0.65"});
etc..
An this is what i am suggesting
$(".lightboxCustom").colorbox({
width: $(this).attr('lWidth'), height: $(this).attr('lHeight'), resize:false, iframe:true, scrolling:"no", opacity:"0.65"
});
this way the attributes lWidth,lHeight would determine the colorbox's dimensions,
the problem is that the loaded conent, on the body will have another pre-defined class that will fix the lightbox CONTENT width..
So how can i remove it?
i saw that colorbox gets this extra params:
$(".lightboxCustom").colorbox({
width: $(this).attr('lWidth'), height: $(this).attr('lHeight'), resize:false, iframe:true, scrolling:"no", opacity:"0.65",
onOpen:function(){ alert('onOpen: colorbox is about to open'); },
onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); }
});
So in what method? onComplete, right? and how can i find/select the body??
trying with:
onComplete:function(){
console.log( $('#cboxIframe').length );
console.log( $('#colorbox #cboxWrapper #cboxLoadedContent iframe').length );
}
but both log 0 and is the class that has the iframe..
EDIT
For now this is the closest i have been:
$(".lightboxCustom").each(function(){
$(this).colorbox({width: $(this).attr('lWidth'), height: $(this).attr('lHeight'), resize:false, iframe:true, scrolling:"no", opacity:"0.65",fastIframe:false,
onComplete:function(){
$(document).bind('cbox_complete',function(){
var iframe = $('#colorbox div#cboxWrapper div div#cboxContent div#cboxLoadedContent iframe#cboxIframe');
var body = iframe.contents().find('body');
console.log(iframe.length); /// ---> 1!!
console.log(body.lenght); /// ---> 1 :(
/*But the problem is that this is empty*/
alert(body.attr('class')); /*when its not*/
})
}
});
});