简体   繁体   中英

How do I reset scroll position of paper-dialog-scrollable?

I have a paper-dialog with a paper-dialog-scrollable how do I reset the scroll position of the dialog everytime its open/closed?

UPDATE

<paper-dialog-scrollable id="disclaimerScroller">

When I open the modal,

this.$.disclaimer.open();
Polymer.dom(this.$.disclaimerScroller).scrollTop = 0;

// I also tried 
this.$.disclaimerScroller.scrollTop = 0

It does not seem to work

You can use scrollTop property. So for example: this.$.scrollableDialog.scrollTop = 0 .

You can add and event listener iron-overlay-opened in paper-dialog which will fire after the paper-dialog is opened. In that listener you can simply put your code to reset the scroll position of the paper-dialog-scrollable .

Example Code:

<paper-dialog id="scrolling" on-iron-overlay-opened="onIronOverlayOpened">

<paper-dialog-scrollable id="disclaimerScroller">

onIronOverlayOpened(){       
   this.$.disclaimerScroller.$.scrollable.scrollTop = 0;
}

Demo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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