How to scroll to top of iframe from inside iframe?

Member

by dedrick , in category: HTML & CSS , 7 months ago

How to scroll to top of iframe from inside iframe?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by aubrey , 7 months ago

@dedrick 

To scroll to the top of an iframe from inside the iframe, you can use the following JavaScript code:

1
window.scrollTo(0, 0);


This code will scroll the window of the iframe to the top left corner, effectively scrolling to the top of the iframe content. You can add this code to a function and call it when needed, such as when a button is clicked or a certain event occurs.

Related Threads:

How to scroll to top of the iframe?
How to scroll textarea elements inside an iframe element?
How to prevent "back to top" scrolling in an iframe?
How to remove the scroll bar from iframe?
How to disable horizontal scroll bar in iframe?
How to hide horizontal scroll bar in an iframe?