# Freeze the Background when Floating Group is up

**URL:** <https://forum.bubble.io/t/freeze-the-background-when-floating-group-is-up/348843>\
**Category:** Need help\
**Created:** [November 18, 2024, 3:11pm UTC](https://forum.bubble.io/t/freeze-the-background-when-floating-group-is-up/348843 "2024-11-18T15:11:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![saranya](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@saranya](https://forum.bubble.io/u/saranya)\
**Post date:** [November 18, 2024, 3:11pm UTC](https://forum.bubble.io/t/freeze-the-background-when-floating-group-is-up/348843/1 "2024-11-18T15:11:27Z")

</div>

Can somebody help me with this. When I open Floating group, I should not be able to scroll the background. I have also made the floating group Fixed height but it doesn’t work.

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/9/4/94e9724a3dc530cf4ac0a38c6d99bc3f18cdaf98.png)

---

<div class="post-metadata">

**Author:** ![marpas](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/marpas/32/230674_2.png) [@marpas](https://forum.bubble.io/u/marpas)\
**Post date:** [November 20, 2024, 4:52am UTC](https://forum.bubble.io/t/freeze-the-background-when-floating-group-is-up/348843/2 "2024-11-20T04:52:21Z")

</div>

To turn off scrolling when FG is visible, you can do the following:

1. Add an ID to the page, for example: “myPage”
2. Add a “Run Javascript” step to the action that is responsible for showing FG with the following JS code inside it:

```auto
savedScrollY = window.scrollY; 
let x = document.getElementById("myPage"); 
x.style.position = "fixed"; 
x.style.top = -savedScrollY+"px";

```

**This will disable scrolling on the page.**

1. Add a “Run Javascript” step to the action that is responsible for hiding FG with the following JS code inside it:

```auto
let x = document.getElementById("myPage"); 
x.style.position = "absolute"; 
x.style.top = "";

resetscroll();

```

**This will enable scrolling on the page again.**

---

<div class="post-metadata">

**Author:** ![saranya](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@saranya](https://forum.bubble.io/u/saranya)\
**Post date:** [November 20, 2024, 8:33am UTC](https://forum.bubble.io/t/freeze-the-background-when-floating-group-is-up/348843/3 "2024-11-20T08:33:01Z")

</div>

> [@marpas](#):
>
> ```auto
> let x = document.getElementById("myPage"); 
> x.style.position = "absolute"; 
> x.style.top = "";
> 
> resetscroll();
> 
> ```

Wow! It really worked… Thanks @marpas …

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [January 27, 2025, 3:11pm UTC](https://forum.bubble.io/t/freeze-the-background-when-floating-group-is-up/348843/4 "2025-01-27T15:11:43Z")

</div>

This topic was automatically closed after 70 days. New replies are no longer allowed.
