HTML, css, and javascript realize floor-hopping page layout

小云云
Release: 2018-01-22 10:09:15
Original
1508 people have browsed it

This article mainly introduces pure html+css+javascript to realize floor-jumping page layout. Friends who need it can refer to it. I hope it can help everyone.

Implementation effect demonstration:

Implementation code and comments:


   楼层跳跃式的页面布局   
  • 第一区域
  • 第二区域
  • 第三区域
  • 第四区域
  1. 1
  2. 2
  3. 3
  4. 4
Copy after login

myScroll .js


function scroll() { // 开始封装自己的scrollTop if(window.pageYOffset !== undefined) { // ie9+ 高版本浏览器 // 因为 window.pageYOffset 默认的是0,所以需要判断 return { left: window.pageXOffset, top: window.pageYOffset } } else if(document.compatMode === "CSS1Compat") { // 标准浏览器,来判断有没有声明DTD return { left: document.documentElement.scrollLeft, top: document.documentElement.scrollTop } } return { // 未声明 DTD left: document.body.scrollLeft, top: document.body.scrollTop } }
Copy after login

Related recommendations:

Understanding of page layout in html

Several methods of adjusting page layout

6 div+css page layout introductory tutorial and summary of usage examples

The above is the detailed content of HTML, css, and javascript realize floor-hopping page layout. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!