纸卷轴标题面板无法正常工作

时间:2015-12-21 22:31:51

标签: polymer web-component paper-elements

HTML文档正文在paper-scroll-header-panel中包含两个独立的neon-animated-page。将neon-animated-page从第0页切换到第1页后,第1页上的paper-scroll-panel无效。

http://jsbin.com/winedi/edit?html,output

1 个答案:

答案 0 :(得分:3)

原因:首次加载时,paper-scroll-header-panel计算标题高度。然后它只收听铁调整事件。但是霓虹灯动画页面在切换页面时不会触发铁调整大小事件。 来自https://github.com/PolymerElements/paper-scroll-header-panel/blob/master/paper-scroll-header-panel.html。第230行

 * By default, the height will be measured when it is ready.  If the height
       * changes later the user needs to either set this value to reflect the
       * new height or invoke `measureHeaderHeight()`.

解决方案:我已经通过显式调用第二个paper-scroll-header-panel的measureHeaderHeight()方法解决了这个问题。检查此http://jsbin.com/visazasena/edit?html,output

Polymer({
  is: "inbox-view",

  next_page: function() {
    document.querySelector("#main-page").selected = 1;
  }

});

将此更改为

Polymer({
  is: "inbox-view",

  next_page: function() {
    document.querySelector("#main-page").selected = 1;
    document.querySelector("#panel").measureHeaderHeight();

  }
});