Home  >  Article  >  Web Front-end  >  How to make others display the middle of the webpage as soon as they open it?_html/css_WEB-ITnose

How to make others display the middle of the webpage as soon as they open it?_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:18:211439browse

I am making a static page demo for a client. The image is very large, so there is a drag bar at the bottom of the browser. Every time I open the page, the leftmost one is displayed by default. Now I want to make it appear every time I open the page. The middle of the web page is displayed at any time, please give me the code~!


Reply to the discussion (solution)

js first calculate the size of the screen, and then set the scrollTop and scrollLeft of the body

http://www .w3school.com.cn/htmldom/met_win_scrollto.asp

window.onload = function(){		scrollTo(250,0)		}


Thank you both very much~! Solved~!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn