Search code examples
javascripthtmljquerycssprestashop

Is there a way to find all the function calls on a button click [Javascript / JQuery ]


I'm actually facing a small but really blocking issue. I'm working on a new theme of a Prestashop Website, I've started with the classic theme of PS 1.7.7.2, then I've made my modifications of every templates, created some dependencies, ect. We've decided to use the ps_imageslider on the home page of the website, so I've decided to modify to make it more resposive, with the possibility to add a mobile image and a desktop image. My only issue with this is that, somewhere in the js code (maybe theme.js or even core.js), there is a callback when the next button of the slider is clicked that make a scroll to the top of the image, but on my new theme, I've decided to make the header sticky at the top, for better ux. I've been digging through the compressed and uncompressed files but didn't been able to find out where is this callback. I've looked on the bootsrap carousel documentation because it's a bs carousel, and didn't find anywhere talking about scrolling to top of the slider when clicking the next button. My only way to find out where this call is made, and to delete it is to debug every functions called on click of the next or prev button, what I've tried to do, but it always give some global functions (with the Events Listener Breakpoints). Is there way to get EVERY functions called when clicking on a button ? I've tried with the scrolling event too, same issue.


Solution

  • Not sure I'm understanding your question correctly but if it seems you are underway in the developer tools. If so, you can view event listeners in chrome for example by right clicking on the button -> inspect -> elements -> event listeners.

    If this is not what you are looking for, maybe profiling will help. See this so answer for it: https://stackoverflow.com/a/11008282/3399855