Вот что у меня есть
function modalThree ($ type) {
var $ type;
jQuery("#simplemodal-container").animate({ width: 250 }, 0);
jQuery("#simplemodal-container").animate({"left": "+=200px"}, "fast");
jQuery("#simplemodal-container").animate({"top": "-=50px"}, "fast");
jQuery('#simplemodal-container').css({
position:'absolute',
left: (jQuery(window).width() - jQuery('#simplemodal-container').outerWidth())/2,
top: (jQuery(window).height() - jQuery('#simplemodal-container').outerHeight())/2
});
jQuery("#dialog").load("/default/modalTwo", function()
{
jQuery("#dialog").modal({
overlay:80,
autoResize:true,
overlayCss: {backgroundColor:"#000"}
});
});
}
мой сайт имеет фиксированную ширину, и я знаю размер контента из вызова ajax.
я изменяю размер, используя следующее
jQuery ("# simplemodal-container"). Animate ({ширина: 250}, 0);
jQuery ("# simplemodal-container"). animate ({"left": "+ = 200px"}, "fast");
jQuery ("# simplemodal-container"). animate ({"top": "- = 50px"}, "fast");
это вроде работает, но я бы хотел посчитать, сколько левого и верхнего мест должно пройти на основе размера окна.
это работает, но я не уверен, что это решение.