# How to kill a function ?

**URL:** <https://forum.wixstudio.com/t/how-to-kill-a-function/28138>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [February 27, 2018, 11:22pm UTC](https://forum.wixstudio.com/t/how-to-kill-a-function/28138 "2018-02-27T23:22:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tristan-breon](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/tristan-breon/32/1231_2.png) [@tristan-breon](https://forum.wixstudio.com/u/tristan-breon)\
**Post date:** [February 27, 2018, 11:22pm UTC](https://forum.wixstudio.com/t/how-to-kill-a-function/28138/1 "2018-02-27T23:22:38Z")

</div>

Hi !

I’ve set the dataset on my dynamic pages to automaticly loads upon reaching the bottom of the page, and I would like to add a ‘back to the top’ and a ‘show footer’ button on this page.

So how can I kill the ‘infinite loader’ function when the user clicks on the ‘show footer’ button ?

Here is the current code (attached to a line placed under the repeater)

```javascript
//automaticly loads more items upon reaching the bottom of the page
export function line12_viewportEnter(event, $w) {
	$w("#dynamicDataset").loadMore()
      .then( () => {
      console.log("Done loading more data");
    });
}

```

Thanks !

---

<div class="post-metadata">

**Author:** ![tristan-breon](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/tristan-breon/32/1231_2.png) [@tristan-breon](https://forum.wixstudio.com/u/tristan-breon)\
**Post date:** [March 14, 2018, 9:34pm UTC](https://forum.wixstudio.com/t/how-to-kill-a-function/28138/2 "2018-03-14T21:34:48Z")

</div>

bump
