# How to detect visibility change in widget?

**URL:** <https://meta.discourse.org/t/how-to-detect-visibility-change-in-widget/115951>\
**Category:** Product Support\
**Created:** [April 25, 2019, 11:24am UTC](https://meta.discourse.org/t/how-to-detect-visibility-change-in-widget/115951 "2019-04-25T11:24:55Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)\
**Post date:** [April 25, 2019, 11:24am UTC](https://meta.discourse.org/t/how-to-detect-visibility-change-in-widget/115951/1 "2019-04-25T11:24:55Z")

</div>

Hi,

I’m currently working on a dropdown menu to show news from my other website, a Blender news platform. I’m using jQuery to build this menu and add it to the menu that I created using the decorateWidget API:

`api.decorateWidget('home-logo:after', helper => {`

This all works fine except for one specific situation: if you scroll down on a topic page, the menu disappears from view. When you scroll back up, the menu re-appears but my inserted HTML is no longer available in the DOM tree. What is the recommended way to detect this visibility change so I can re-populate the menu?

Thanks!

---

_[View the full topic](https://meta.discourse.org/t/how-to-detect-visibility-change-in-widget/115951)._
