scrollintoview | XM Community
Skip to main content
Solved

scrollintoview

  • July 24, 2023
  • 2 replies
  • 82 views

Forum|alt.badge.img+6
  • Level 2 ●●
  • 19 replies

I have 4 questions on a page (the firs two are text/graphic while the last two are multiple choice). On load, I want the second question to scrollintoview. 

I learned (from this forum), that I can use 

jQuery(".QuestionOuter").last().get(0).scrollIntoView(); 

to automatically scroll to the last question on the page. However, I can’t seem to figure out a way to modify the code to scroll to the second question… I have used different integer indexes in get(), but those don’t seem to achieve what I want. 

Any help is appreciated!

Best answer by Deepak

@pb7 

Try this:

jQuery('.QuestionOuter').eq(1).get(0).scrollIntoView();

Hope it helps!

2 replies

Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+46
  • 1555 replies
  • Answer
  • July 24, 2023

@pb7 

Try this:

jQuery('.QuestionOuter').eq(1).get(0).scrollIntoView();

Hope it helps!


Forum|alt.badge.img+6
  • Author
  • Level 2 ●●
  • 19 replies
  • July 25, 2023

Thanks @Deepak. This works perfectly!