Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In a Browser, Break on Window Scroll

In Chrome Devtools, you can break javascript on changing a DOM element's attributes, or on subtree modifications of an element.

I'm working on some legacy code that has some javascript that scrolls to the top of the page under certain situations, and I want to find the JS that does this.

Is there a way, in Devtools, so break on scroll events?

It could be jQuery or Prototype.js or event base JS that does it, and I've searched the codebase for .scrollTop or .animate, and I've found plenty of those, but none that are causing my issue.

like image 987
Joshua Soileau Avatar asked Oct 20 '14 19:10

Joshua Soileau


People also ask

How do you scroll down in a web browser?

Simple steps to scroll down in a web browser To scroll down in a web browser simply press your keyboard spacebar. To scroll up press shift + spacebar while viewing a website. You can also place your cursor over the website content you are viewing and press your up/down keyboard arrow keys.

How to scroll the window to a particular place in the document?

The Window.scroll() method scrolls the window to a particular place in the document. window.scroll(x-coord, y-coord) window.scroll(options) x-coord is the pixel along the horizontal axis of the document that you want displayed in the upper left. y-coord is the pixel along the vertical axis of the document that you want displayed in the upper left.

What is the window scroll method in HTML?

HTML DOM Window Scroll () Method Last Updated : 29 Jul, 2020 The Window scroll () method scrolls the window to a particular place in the document. This method is different form scrollTo () method as it takes different parameters like scrolling behavior, etc using ScrolltoOptions Dictionary.

How do I control the autoscroll bookmarklet while scrolling?

You can use the following keyboard shortcuts to control the Autoscroll bookmarklet while scrolling is in progress: 0–9 — Sets scroll speed (higher is faster) – (minus) — Decreases scroll speed = (equals) — Increases scroll speed


1 Answers

I have no additional idea about actually breaking than the ones presented.

But i suspect it is not scrolling that causes the issue, but a '#' in the html.

<a href="#" onclick="return false;">x</a>

is a very common pattern. when you forget (or something prevents) the "return false", the # (empty anchor) will be navigated to, which causes a scroll to top.

Check if the url has a # at the end after clicking!

like image 191
ZPiDER Avatar answered Sep 28 '22 06:09

ZPiDER