Skip to content

Commit

Permalink
Added scroll delay
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Ortega Moreno committed Mar 8, 2017
1 parent be854d9 commit a37efd3
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion traffic-incidents.html
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@
traffic_info="{{traffic_info}}" radio="{{radio}}" on-traffic_info-ready="_data_ready"
on-traffic-request_iniciated="_loading_data" on-geocoding-request-error="_empty"></traffic-incidents-data>

<paper-header-panel mode="waterfall-tall">
<paper-header-panel mode="waterfall-tall" on-content-scroll="scrolled">
<div class="paper-header horizontal layout center" active$="{{active}}" >
<paper-icon-button icon="search" id="search" on-click="toggleInput"></paper-icon-button>
<div class="input-container" on-click="focusInput">
Expand Down Expand Up @@ -500,7 +500,16 @@
_text: {
type: Object,
computed: '_setLanguage(language,_lang)'
},
step: {
type:Number,
value:0
},
discardStepNumber: {
type:Number,
value:6
}

},
_setLanguage: function(lang,_lang){
if (_lang){
Expand Down Expand Up @@ -622,6 +631,16 @@
a = a && b? a:c;a = a && b? a:c;a = a && b? a:c;
a = a && b? a:c;a = a && b? a:c;a = a && b? a:c;
},
scrolled: function (evt) {
this.step += 1;
var el = evt.currentTarget.$$('#mainContainer');
if (!this.discardStepNumber || this.step < this.discardStepNumber) {
this.lastValidScroll = el.scrollTop;
} else {
el.scrollTop = this.lastValidScroll;
this.step = 0;
}
},
});
</script>
</dom-module>

0 comments on commit a37efd3

Please # to comment.