Home > other >  How to use JS move scroll bar to the specified element position?
How to use JS move scroll bar to the specified element position?

Time:09-21

I saw someone in baidu said the document. This method getElementById (id) offsetHeight can get to the element height,
Element ID, but not in the page visible range, need to slide the scroll bar, with the following code returns a value of 0
Js="var q=document. GetElementById (' shenfen_zhengmian_read). OffsetHeight; Alert (q) "
Self. Driver. Execute_script (js)
Who is a great god can give a suggestion, it is better to have a code, thank you very much

CodePudding user response:

'shenfen_zhengmian_read use offsetHeight or offsetLeft... Conditions such as: 1 elements must be positioning, 2 to ensure that the element is loaded
  • Related