'How to ScrollLeft 50% and ScrollTop using jQuery [duplicate]

I have the solution. I noticed new trainees find it difficult to implement some functionality at times.

Strongly not for ratings but for education purposes



Solution 1:[1]

let scroll_width = $('.the-class').width();
let scroll_height = $('.some-class').height() / 2; //for half of..
$('.some-class').scrollLeft(scroll_width);
$('.some-class').scrollTop(scroll_height);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gautam