Template[getTemplate('layout')].helpers({ mobile_nav: function () { return getTemplate('mobile_nav'); }, nav: function () { return getTemplate('nav'); }, messages: function () { return getTemplate('messages'); }, notifications: function () { return getTemplate('notifications'); }, footer: function () { return getTemplate('footer'); }, pageName : function(){ return getCurrentTemplate(); }, css: function () { return getTemplate('css'); }, heroModules: function () { return heroModules; }, getTemplate: function () { return getTemplate(this.template); } }); Template[getTemplate('layout')].created = function(){ Session.set('currentScroll', null); }; Template[getTemplate('layout')].rendered = function(){ if(currentScroll=Session.get('currentScroll')){ $('body').scrollTop(currentScroll); Session.set('currentScroll', null); } }; Template[getTemplate('layout')].events({ 'click .inner-wrapper': function (e) { if ($('body').hasClass('mobile-nav-open')) { e.preventDefault(); $('body').removeClass('mobile-nav-open'); } } });