Search code examples
javascripthtmlonclickonclicklistener

How to see which JS file governing this click-to-expand content on a website?


I'm looking at this url. The original display is

enter image description here

After I click on the plus sign,

enter image description here

I see that <section> changes to <section expand>, and aria-expanded="false" changes to aria-expanded="true". Could you please elaborate on how to determine which JS file governs this behavior?

I can see many JS files in section "Event Listeners" but could not figure out?

enter image description here


Solution

  • I had a look at the page. From your screenshot you can see there is only one of the event listeners on "click" that applies to that specific header element - amp-accordion.js.

    This name makes sense as it is an accordion effect you're looking at.

    Inside the .js file referenced there are a number of sections governing the accordion effect. If you'd like to investigate further I recommend searching for the term "accordion" in the js source - CTRL+F, "accordion".