1

I've just noticed that the .scroll and scrollTo methods are undefined when invoked on DOM elements in Safari. Chrome and Firefox seem to handle the issue right.

I've added this jsfiddle to ilustrate the problem. Open it in Chrome, Firefox and Safari to and check the Console panel. I'm on a mac, by the way.

Do you know of any alternative or woraround?

2 Answers2

2

The .scrollLeft and .scrollTop properties are well supported in current browsers, including Safari, and can be used to get or change horizontal and vertical scrolling offset.

element.scrollLeft = x;
element.scrollTop  = y;
GOTO 0
  • 42,323
  • 22
  • 125
  • 158
0

Chrome is throwing undefined for me as well. I think these methods are only window methods see w3 schools reference here.

realappie
  • 4,656
  • 2
  • 29
  • 38
  • you are right. Looks like I have some extra functionality enabled in Chrome via flags. Anyway, I need to scroll horizontally via javascript, any thoughts on that? – Sebi Kovacs Feb 03 '17 at 16:12