当前位置:网站首页>Slide the navigation fixed head upwards
Slide the navigation fixed head upwards
2022-06-10 12:16:00 【000000001111】
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Slide the navigation fixed head upwards </title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
.title {
width: 100%;
height: 20px;
margin-bottom: 30px;
}
.nav {
width: 100%;
height: 20px;
background: #CDDC39;
}
.main {
width: 100%;
height: 2000px;
}
/* Realization ie6 I won't support it fixed Method */
.navFixed {
position: fixed;
left: 0;
top: 0;
_position: absolute;
top: expression((offsetParent.scrollTop)+0);
z-index: 2;
}
</style>
</head>
<body>
<script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
var headHeight = $(".title").height() + 30; //title Height plus margin-bottom value
var nav = $(".nav");
$(window).scroll(function() {
if ($(this).scrollTop() > headHeight) {
nav.addClass("navFixed");
} else {
nav.removeClass("navFixed");
}
})
})
</script>
<div class="title">
Fixed to the head
</div>
<div class="nav"></div>
<div class="main">
<br>
<br>
<br>
<br>
<br>
<br>
<br>
Slide the Yellow slider up to fix it to the top ~
</div>
</body>
</html>

边栏推荐
- STM32学习笔记(2)-USART(基础应用1)
- Using Joern to process a large number of files and generate PDG is a slow solution
- Clip usage
- 向上滑动导航固定头部
- Missed scanning tool learning notes
- web开发发展趋势,web计划开发
- SQL查询结果添加行号字段----sqlserver
- IO文件流重复读取
- 使用Joern处理大量文件,生成PDG速度很慢的解决方法
- Driver. JS - open source and independent interactive guidance tool library for web novices, powerful and highly customizable
猜你喜欢

数字经济时代,零售实体门店该何去何从

Transfomer self implementation and official library
![[required] analysis of the real problem](/img/36/08c752763b8b89aa60feaa4339a689.png)
[required] analysis of the real problem

web端开发,web开发选型

Before we learn about high-performance computing, let's take a look at its history

使用Joern处理大量文件,生成PDG速度很慢的解决方法

H5 pop up prompt layer - top, bottom, left and right center

(5) Class, object and class file splitting operation (2)

文档提升计划第二期|OceanBase 邀您一起进行文档共建

2022 年 5 月产品大事记
随机推荐
C语言最佳实践之库文件介绍(下)
在启牛开户证券安全吗
Zipoutputstream use
(七)深拷贝与浅拷贝
4.25 million budget bidding: centralized procurement of onsite maintenance services for Oracle, teledb, telepg and other core system databases of Jiangsu Telecom
Shadergraph - 301 bouncing ball
js全局计时器的案例
SQL查询结果添加行号字段----sqlserver
Lua syntax
【已解决】vagrant up下载box速度太慢的解决方法
element弹出框关闭并销毁:清空弹出里的数据缓存(整理)
C語言最佳實踐之庫文件介紹(下)
Collected data, must see
已拿offer,进阶学习
(四)类和对象(1)
SQL Server AlwaysOn查看数据同步进度
Shadergraph - water surface
GIMP - 免费开源的图像处理软件,功能强大,被称为 Photoshop 的优秀替代品
Minimalist random music player
STM32F407学习笔记(1)-EXTI中断事件与NVIC寄存器