简体   繁体   English

应用程序下方的空格-Ember.js

[英]Whitespace below application - Ember.js

I haven't been able to find an answer for this question yet, so maybe no one is having it. 我还没有找到这个问题的答案,所以也许没人能找到答案。 I'm pretty sure its impossible to replicate on a jsfiddle. 我很确定它不可能在jsfiddle上复制。

So, I have a page that gets a little long, probably 2200-2500px. 因此,我的页面变得有点长,可能是2200-2500px。 But when a user hits submit on the page (located at the bottom of the page), they are left with a white screen and a navbar (something that's at the top of the page). 但是,当用户在页面上单击“提交”(位于页面底部 )时,他们将被留下一个白色屏幕和一个导航栏(位于页面顶部)。 That's the description I'm getting from users that are not computer literate... 这就是我从非计算机知识用户那里得到的描述...

As it turns out, when ember removes the route from the application outlet, its not removing the space below so there's a large whitespace below the next page causing users to have to scroll up to see the next page content. 事实证明,当ember从应用程序插座中删除路由时,它没有删除下方的空间,因此下一页下方有一个较大的空白,导致用户不得不向上滚动才能看到下一页的内容。

I am programatically calling ex. 我以编程方式致电给ex。 route.transitionTo('page-after-submit'); . I'm not sure if there's a bug or something in Ember itself causing this issue. 我不确定Ember本身是否存在错误或其他原因导致此问题。 Anyone know? 有人知道吗

Extra info: 额外信息:

  • Structure of the page is ApplicationView->SignUpRouteView transitioning to ApplicationView->NewUserView . 该页面的结构是ApplicationView->SignUpRouteView过渡到ApplicationView->NewUserView

  • Ember Version: v1.3.0 灰烬版本: v1.3.0

  • Handlebars Version: v1.1.2 车把版本: v1.1.2

Pic of the phenomenon: 图片的现象: 空白

This is 'normal' behavior - Ember preserves the scroll position when you change routes. 这是“正常”行为-更改路线时,Ember会保留滚动位置。 To change that include the following in your ApplicationController 要更改它,请在ApplicationController中包括以下内容

App.ApplicationController = Ember.Controller.extend({
  currentPathChanged: function() {
    if (window) window.scrollTo(0, 0);  
  }.observes('currentPath')
});

This will scroll to the top of the page every time you transition between routes 每次在路线之间转换时,它将滚动到页面顶部

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM