我有一个应用程序,我需要显示图像(点击缩略图后),用流星写的。
我能够将图像存储在gridFS中并将它们拉出来,但我正在努力研究如何动态调整模态对话框以显示完整尺寸的图像。
我想我需要为对话捕获bs-show事件并将.css.width属性设置为所需的大小,但我不知道如何拦截流星中的bs-show事件。
我已尝试在应用中添加以下代码
Template.projectImageItem.events = {
"click .open-modal" : function(e,t) {
e.preventDefault();
Session.set("selectedImageId", t.data._id);
Session.set("showProjModal", true);
//console.log("Image ID: "+ Session.get("selectedImageId"));
console.log($("projectImageModalID").find('modal-body'));
$("projectImageModalID").find('modal-body').css({
width: '20px'
});
$("#projectImageModalID").modal("show");
}
};
并且在chrome调试器中可以看到返回到consol日志的对象,但是css更改在显示之前没有任何效果,所以我想我不适合这个。