Vertical Scroll bar to move top of the page
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 68
- Joined: Mon Jul 04, 2022 8:42 am
Vertical Scroll bar to move top of the page
Hi Oxygen team,
I am working on web author mode and have added script in plugin window.scrollTo() to move vertical scroll bar to top of the page but its not working.
I would like to know what is the best way to move scroll to top of the page.
I am working on web author mode and have added script in plugin window.scrollTo() to move vertical scroll bar to top of the page but its not working.
I would like to know what is the best way to move scroll to top of the page.
-
- Site Admin
- Posts: 95
- Joined: Thu Jun 09, 2016 2:01 pm
Re: Vertical Scroll bar to move top of the page
Post by Gabriel Titerlea »
Hello,
You can scroll the document in different ways, depending on what you want to achieve.
If you want to scroll to a given xml-element you can use the SelectionManager.scrollSelectionIntoView javascript API [1]. Here's an example where I'm scrolling to the beginning of the root element:
Alternatively, if you are not interested in scrolling to a certain xml-element. You can change the scrollTop [2] of the html-element with ID editor-frame. Note that this element ID is not marked as a public API, and it may change in future versions.
Best,
Gabriel
[1] https://www.oxygenxml.com/maven/com/oxy ... ew__anchor
[2] https://developer.mozilla.org/en-US/doc ... /scrollTop
You can scroll the document in different ways, depending on what you want to achieve.
If you want to scroll to a given xml-element you can use the SelectionManager.scrollSelectionIntoView javascript API [1]. Here's an example where I'm scrolling to the beginning of the root element:
Code: Select all
let selectionManager = editor.getSelectionManager();
let doc = editor.getEditingSupport().getDocument();
let selection = selectionManager.createEmptySelectionBeforeNode(doc.firstChild);
selectionManager.scrollSelectionIntoView(selection);
Best,
Gabriel
[1] https://www.oxygenxml.com/maven/com/oxy ... ew__anchor
[2] https://developer.mozilla.org/en-US/doc ... /scrollTop
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service