js+css实现菜单滚动滚定在顶部效果代码

代码语言:html

所属分类:菜单导航

代码描述:js+css实现菜单滚动滚定在顶部效果代码

代码标签: 滚动 滚定 顶部 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">

<link href="https://fonts.googleapis.com/css?family=Roboto:400,700" rel="stylesheet">
  
  
  
<style>
/* helpers/grid.css */

.grid {
  margin-left: auto;
  margin-right: auto;
  max-width: 48em;
  width: 90%;
}

/* helpers/sticky.css */

.sticky {
  position: -webkit-sticky;
  position: sticky;
  will-change: transform;
}

.sticky--top {
  top: 0;
}

/* layout/base.css */

* {
  -webkit-box-sizing: inherit;
          box-sizing: inherit;
}

html {
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
  height: 100%;
}

body {
  font-family: 'Roboto', sans-serif;
  line-height: 1.75;
  margin: 0;
  min-height: 100%;
}

/* layout/header.css */

.header {
  background-color: #fff;
  padding-bottom: 1em;
  padding-top: 1em;
}


.header::after {
  bottom: 0;
  -webkit-box-shadow: 0 0.0625em 0.5em rgba(0, 0, 0, .3);
          box-shadow: 0 0.0625em 0.5em rgba(0, 0, 0, .3);
  content: '';
  left: 0;
  opacity: 0;
  position: absolute;
  right: 0;
  top: 0;
  -webkit-transition: opacity 0.3s;
  transition: opacity 0.3s;
  z-index: -1;
}

.header.is-active::after {
 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0