Home > Web Front-end > HTML Tutorial > 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
Release: 2016-06-24 12:18:21
Original
1475 people have browsed it

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)		}
Copy after login


Thank you both very much~! Solved~!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template