重新调整窗口大小meteor.js?
问题描述:
任何人都想出使用Meteor.js重新渲染模板窗口大小的语法?我试图做一个Meteor.flush(),但似乎并没有调整窗口大小时,是正确的做法.... :(重新调整窗口大小meteor.js?
window.onresize = function(){
Meteor.flush();
};
答
更改一些会话值,然后才有模板听对这种变化:
<template name="body">
{{touch}}
</template>
Template.body.touch = function() {
return Session.get("touch");
}
Meteor.startup(function() {
$(window).resize(function(evt) {
Session.set("touch", new Date());
});
});
*这*完全是聪明的我要去给它一个尝试:)只 – AbigailW
日期每秒一次的更新。!。这里有一个方法,如果需要的话会更有响应Session.set(“touch”,$(window).width()+ $(window).height());'' –