# Refresher in scrollable slides

**URL:** <https://forum.ionicframework.com/t/refresher-in-scrollable-slides/63300>\
**Category:** ionic-v3\
**Created:** [September 13, 2016, 3:19pm UTC](https://forum.ionicframework.com/t/refresher-in-scrollable-slides/63300 "2016-09-13T15:19:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gunnaway](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/gunnaway/32/111923_2.png) [@Gunnaway](https://forum.ionicframework.com/u/Gunnaway)\
**Post date:** [September 13, 2016, 3:19pm UTC](https://forum.ionicframework.com/t/refresher-in-scrollable-slides/63300/1 "2016-09-13T15:19:58Z")

</div>

I have a ion-content view that contains an ion-refresher and ion-slides. These slides have their own scrolling content (css overflow: scroll) with each a ion-infinite-scroll.  
Now when i scroll down the page and a little back up, the ion-refresher triggers before the slides’ scroll content reaches the top.

Another issue I notice is that all ion-infinite-scroll events are triggered when one reaches the end of scrollable content.

Does anyone have an idea how to resolve this?

---

<div class="post-metadata">

**Author:** ![teamo](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@teamo](https://forum.ionicframework.com/u/teamo)\
**Post date:** [August 10, 2017, 5:43am UTC](https://forum.ionicframework.com/t/refresher-in-scrollable-slides/63300/2 "2017-08-10T05:43:53Z")

</div>

I have the exact same issue. Did you already figure out how to fix this?

---

<div class="post-metadata">

**Author:** ![Gunnaway](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/gunnaway/32/111923_2.png) [@Gunnaway](https://forum.ionicframework.com/u/Gunnaway)\
**Post date:** [August 10, 2017, 8:10am UTC](https://forum.ionicframework.com/t/refresher-in-scrollable-slides/63300/3 "2017-08-10T08:10:05Z")

</div>

Unfortunately nothing so far. I created my own solution for the time being but this is far from perfect.

---

<div class="post-metadata">

**Author:** ![xbhavincb](https://avatars.discourse-cdn.com/v4/letter/x/e0b2c6/32.png) [@xbhavincb](https://forum.ionicframework.com/u/xbhavincb)\
**Post date:** [January 17, 2018, 1:41pm UTC](https://forum.ionicframework.com/t/refresher-in-scrollable-slides/63300/4 "2018-01-17T13:41:20Z")

</div>

Here is the workaround could be used untill the issue is fixed.

```auto
import { Directive, ElementRef } from '@angular/core';

/**
 * Wee need this directive to prevent page refresh on grid view scrolling
 */
@Directive({
    selector: '[scrollCatcher]'
})
export class ScrollCatcherDirective {

    private scrollElement: HTMLElement;

    constructor(private el: ElementRef) {
    }

    ngOnInit() {
        this.scrollElement = this.el.nativeElement.getElementsByClassName(
            'scroll-content',
        )[0];
        this.scrollElement.addEventListener(
            'touchstart',
            (event: TouchEvent) => {
                event.stopImmediatePropagation();
                event.cancelBubble = true;
            },
        );

        this.scrollElement.addEventListener('touchend', (event: TouchEvent) => {
            event.stopImmediatePropagation();
            event.cancelBubble = true;
        });
    }
}

```

Apply this directive for ion-content.

```auto
<ion-content scrollCatcher>
<ion-refresher (ionRefresh)="doRefresh($event)">
    <ion-refresher-content></ion-refresher-content>
  </ion-refresher>
</ion-content>

```

---

<div class="post-metadata">

**Author:** ![Maniak11](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Maniak11](https://forum.ionicframework.com/u/Maniak11)\
**Post date:** [July 25, 2018, 2:59pm UTC](https://forum.ionicframework.com/t/refresher-in-scrollable-slides/63300/5 "2018-07-25T14:59:23Z")

</div>

You will have to control the ion-refresher being enabled based on if the ion-slide scrollTop is less than 10. This way you will be restricting its enabled state and it won’t be triggered with scroll up inside the ion-slide or ion-scroll and scroll position will be retained in each slide.  
Code Sample below -  
  
\<ion-refresher [enabled]=“isRefresherEnabled()”(ionRefresh)=“doRefresh($event);”\>

```
</ion-refresher-content>

 </ion-refresher>

<ion-slides>

    <ion-slide *ngFor="let slide of slides;let i = index;">
     <ion-scroll class="y-scroll-custom" scrollY="true" #myScroll>
     <!--put long text--> 
     </ion-scroll>
    </ion-slide>
  </ion-slides>

</ion-content>

```

in your corresponding \*.ts file -

```
import { ViewChildren, QueryList } from '@angular/core';
import { Slides} from 'ionic-angular';

@ViewChild('mySlider') slider: Slides;
@ViewChildren('myScroll') components:QueryList<Scroll>;

isRefresherEnabled() {
	if (this.slider) {
		const activeSlideIdx = this.slider.getActiveIndex();
		if (this.components && this.components['_results']) {
			if (this.components['_results'][activeSlideIdx]) {
				if (this.components['_results'][activeSlideIdx]['_scrollContent']) {
					if (this.components['_results'][activeSlideIdx]['_scrollContent'].nativeElement.scrollTop <= 10) {
						return true;
					}
				}
			}
		}
	}
	return false;
}
```

---

<div class="post-metadata">

**Author:** ![Ratikanta](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ratikanta/32/109400_2.png) [@Ratikanta](https://forum.ionicframework.com/u/Ratikanta)\
**Post date:** [April 2, 2020, 11:14am UTC](https://forum.ionicframework.com/t/refresher-in-scrollable-slides/63300/6 "2020-04-02T11:14:31Z")

</div>

ion-scroll is not there in ionic 4, do you have any solution for this?

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:01pm UTC](https://forum.ionicframework.com/t/refresher-in-scrollable-slides/63300/7 "2021-07-19T21:01:17Z")

</div>

Closed on July 19, 2021, 9:01pm UTC


