> For the complete documentation index, see [llms.txt](https://docs.diffy.website/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.diffy.website/features/javascript-snippets.md).

# JavaScript snippets

Way to test you dropdown menus, popups and other interactive elements

Imagine you would like to take a screenshot of your page with the main menu expanded. You can do that by providing a little javascript snippet that will do exactly that right before we take the screenshot.

For that, we recommend using anchor tags so JavaScript knows when to run. So you have pages in the project:

```
https://example.com
https://example.com#top-menu
```

And then under the javascript section, you can target the anchor tag

```
if (window.location.hash == '#top-menu') {
  jQuery('header').find('.header__menu-toggle').click();
}
```

<figure><img src="https://2808221030-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWkSLD59cnd4ChYfmqo3r%2Fuploads%2Fvm16Dj06wQ4jjRIVRzPL%2Fimage.png?alt=media&amp;token=1c22c208-d4b8-4272-bb97-d6e7b44c0cc3" alt=""><figcaption><p>javascript snippets in action</p></figcaption></figure>
