I have a div which is in the fixed header table format which has more than 24 columns.
The table contains columns in ascending order and it has a horizontal and vertical scroll bar.
So I need to move the horizontal scroll bar of div to right end during the loading. I'm using angular 7 for frontend.
I have tried by using javascript scrollIntoView
but it is not working.
Anyone suggest me a way to achieve this using angular or javascript but not jquery.
You can achieve this with pure JavaScript, using the Element.scrollLeft
and Element.scrollWidth
properties in combination.
See the documentation here and here.
Something like this should work.
myDivElement.scrollLeft = myDivElement.scrollWidth;
Here is a fiddle demonstrating the technique.
Not tested thoroughly though, and also not sure about browser compatibility and minor tweaks. Use this just as an initial hint.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With