Diffy documentation
  • Features
    • 👋Welcome
    • Mask & Exclude
    • JavaScript snippets
    • HTTP headers
    • Cookies
    • CSS overrides
    • Mock content
    • Dealing with Dynamic Elements
      • Freeze Carousels / Sliders
      • Cookies Policy Popups
    • Configure project from YAML file
    • Zapier integration (JIRA, Trello, Basecamp integrations)
    • Bypass protection Cloudfront, Akamai, Incapsula
      • Bypass Akamai protection
      • Bypass Imperva Incapsula protection
    • Tags
    • Local development
      • DDEV add-on
      • Lando integration
      • Standalone docker container
      • Ngrok
  • Automation
    • 💡Overview
    • GitHub Pantheon CircleCI
    • GitHub Pantheon GitHub Actions
    • GitHub Tugboat
  • Tutorials
    • Comparison review
Powered by GitBook
On this page
  1. Features

JavaScript snippets

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

PreviousMask & ExcludeNextHTTP headers

Last updated 1 year ago

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();
}
javascript snippets in action