Questions tagged [js-scrollintoview]

The Element.scrollIntoView() method scrolls the current element into the visible area of the browser window.

Syntax

element.scrollIntoView(); // Equivalent to element.scrollIntoView(true)
element.scrollIntoView(alignToTop); // Boolean arguments
element.scrollIntoView(scrollIntoViewOptions); // Object argument

MDN

https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView

Can I use?

desktop

mobile

A good answer on SO

Demo

https://jsbin.com/cuweho

162 questions
0
votes
1 answer

How can I use scroll into view from different/other page with react and redux?

I am somewhat new to frontend development and have just landed my first job in this area. I am working on a site right now built with React and Redux. The issue I am having is on a page which contains of several sections of divs. The buttons in the…
Joel 8 bitar
  • 123
  • 1
  • 3
  • 16
0
votes
0 answers

React: scrollIntoView on componentDidMount using refs

I am rendering a Dialog component with a lot of text and the dialog has therefore a scroll. Text contains some links, and the content of the Dialog changes when a link is clicked. The problem is, when the content changes, the scroll stays in the…
0
votes
1 answer

scrollIntoView to anchor in different components

I have an Angular 8 SPA with a fixed-top navbar to auto-scroll the user to the section he clicked. In the first place, I used a simple href="#section1". When the user clicks on a link in the navbar, the associated section is displayed properly. But…
Sixteen
  • 443
  • 1
  • 4
  • 23
0
votes
3 answers

How to make selenium to scroll to view ability of element

Hey All I have a question regarding selenium I have a very long form, and I want to scroll a little bit down for entering data. I do not want it to scroll all the way just until the element is displayed. I used this code: WebElement element =…
Bastian
  • 1,089
  • 7
  • 25
  • 74
0
votes
1 answer

TypeError: Cannot read property 'scrollIntoView' of null In React Table

const modal =({messages})=>{ const messagesEnd = React.useRef(null); const scrollToBottom = () => { messagesEnd.current.scrollIntoView({ behavior: "smooth" }); }; useEffect(() => { …
Himanshu Sain
  • 73
  • 1
  • 3
  • 8
0
votes
1 answer

Automatically scroll to a specific part of the home (root) page from a separate url back link

I have this base code on my website's home page (myexample.com): setTimeout(function(){ document.getElementById("pizza3").scrollIntoView( {behavior: 'smooth'} ); }, 2000); Now as it stands, the scrolling effect will fire on every call to the…
CMR
  • 13
  • 5
0
votes
4 answers

Selenium crashes when I'm trying to parse the next page (and seven after it) on a website. Any way to tackle this?

I want to parse an IMDb film rating located here on around 8 pages. In order to do that I'm using Selenium, and I'm having trouble with clicks, proceeding algorithm to next page. In the end I need 1000 titles when I'll continue using BeautifulSoup.…
0
votes
0 answers

How to avoid focusing on next element on TAB key press after scrollIntoView on page-load in chrome browser

I am facing this weird issue on Chrome browser only. I am using scrollIntoView method just after page load (ngAfterViewInit of angular component). So, when the page is loaded and it scroll's to element, everything is fine. Now, when I press the TAB…
0
votes
2 answers

Lazy Loading and ScrollIntoView() Angular2(version 7)

I'm trying to show a component when first load the page with lazy loading that only load the content if it's in the view. For example: - There are 10 components on the page and I want to show/scroll to the component number 7 on first load with…
0
votes
2 answers

Get focus(or scroll into view) to a panel using jquery

I am setting up a form in which user will be able to see their selection of radio button(of a particular value) on a button click. i am able to get the radio button focus and make the page to scroll to it, but want the parent panel-body to get…
0
votes
0 answers

element.scrollIntoView(scrollIntoViewOptions) in Safari and IE always scrolls to the top instead of center

I'm using the following call to scroll an element into view in Chrome: element.scrollIntoView({ block: 'center', inline: 'nearest }) It works properly in Chrome, but in Safari and IE/Edge, it always scrolls as if I've used block: 'start'. Even…
0
votes
1 answer

How to handle multiple scrollintoview in selenium webdriver

I need to scroll a page to specific div which contains specific word "Load more" which has multiple text in multiple div. Here is my code List Loadmore = driver.findElements(By.xpath("//div[contains(text(), 'Load more')]")); for(int…
0
votes
0 answers

scrollIntoView function doesn't scroll anywhere

I can't figure out why, but scrollIntoView() function doesn't work in Chrome Version 71.0.3578.98 and I believe in any other either. The browser displays no errors and screen isn't scrolling anywhere. I haven't been able to find any answer in the…
Andrew Shaban
  • 129
  • 2
  • 16
0
votes
1 answer

Uncaught TypeError: scrollIntoView is not a function

I can't figure out why, but scrollIntoView() function doesn't work. The browser displays an error: Uncaught TypeError: element.scrollIntoView is not a function at .... The element element is defined and displayed in console. I haven't been able to…
Andrew Shaban
  • 129
  • 2
  • 16
0
votes
0 answers

JavaScript - scrollIntoView() only works in Firefox

I'm trying to scrollIntoView() on a SVG element. It works on Firefox as intended but on Chrome and Edge it scrolls down too far or some other place that is wrong. cluster_Legend
crypt555
  • 3
  • 6
1 2 3
10
11