# Tutorial: Scroll within a popup without scrolling the page

**URL:** <https://forum.bubble.io/t/tutorial-scroll-within-a-popup-without-scrolling-the-page/144153>\
**Category:** Tips\
**Created:** [March 31, 2021, 10:38pm UTC](https://forum.bubble.io/t/tutorial-scroll-within-a-popup-without-scrolling-the-page/144153 "2021-03-31T22:38:02Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![markeaston](https://avatars.discourse-cdn.com/v4/letter/m/e9a140/32.png) [@markeaston](https://forum.bubble.io/u/markeaston)\
**Post date:** [January 20, 2025, 6:27pm UTC](https://forum.bubble.io/t/tutorial-scroll-within-a-popup-without-scrolling-the-page/144153/23 "2025-01-20T18:27:21Z")

</div>

Thanks Rob, very useful. Got me started for sure!

This is what I used to freeze the page underlying in the place I left it.

**Javascript run before the workflow 'show Popup**

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

**Javascript run when closing the popup**

let x = document.getElementById(“myPage”);  
x.style.position = “absolute”;  
x.style.top = “”;  
window.scrollTo(0, savedScrollY);

I wasn’t worried about my popup detail scrolling inside the popup but I did want the page to ‘stay where I left it’. Hope this helps anyone who wanted that.

[Previous page](https://forum.bubble.io/t/tutorial-scroll-within-a-popup-without-scrolling-the-page/144153.md?page=1)
