吸顶条或者其他的吧

<!DOCTYPE html>
<html>
<head>
<style>
*{margin: 0;padding: 0;list-style: none;}
body{
width: 1180px;
margin: 0 auto;
}
.head{
width: 100%;
height: 60px;
background: red;
}
.main{
margin: 30px 0 ;
height: 100%;
overflow: hidden;

}
.foot{
width: 100%;
height: 40px;
background: #000;
clear: both;
}
.left{
float: left;
width: 210px;
height: 1300px;
border: 1px solid red;
background: green;
}

.right{
float: right;
width: 930px;
height: 900px;
border: 1px solid red;
background: #ccc;

}
</style>
<!--
<script>
(function(){
window.onresize=window.onscroll=window.onload=function (){
var oDiv=document.getElementById(‘form-wrap‘);
var scrollTop=document.documentElement.scrollTop || document.body.scrollTop;
var clientHeight=document.documentElement.clientHeight;
var t=document.body.scrollHeight;
var bodyH= scrollTop+clientHeight;
if(Math.abs(bodyH - t ) < 5){
oDiv.style.bottom=‘40px‘;
}else{
oDiv.style.bottom=‘0px‘;
}
};
})();
</script>
-->
<script>
window.onload= window.onscroll=function(){
var oLeft = document.getElementById(‘left‘);
var oRight = document.getElementById(‘right‘);
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;

//当left的height最大为right的高
if(oLeft.offsetHeight >oRight.offsetHeight){
oLeft.style.height =getStyle(oRight,‘height‘) +‘px‘;
}

//当left的scrollTop为0,fixed
if(scrollTop > oLeft.offsetTop){
oLeft.style.position =‘fixed‘;
oLeft.style.top = ‘0‘;
if(oLeft.offsetHeight<oRight.offsetHeight){
oLeft.style.height =getStyle(oRight,‘height‘) +‘px‘;
}else{
oLeft.style.height =document.documentElement.clientHeight -70 +‘px‘;
}
}else{
oLeft.style.position =‘‘;
}

function getStyle(obj,name){
return obj.currentStyle ? obj.currentStyle[name] :getComputedStyle(obj, false)[name];
}

}
</script>
</head>
<body>
<div class="head"></div>
<div class="main">
<div class="left" id="left">
<ul>
<li>菜单1</li>
<li>菜单2</li>
<li>菜单3</li>
<li>菜单4</li>
<li>菜单5</li>
</ul>
</div>
<div class="right" id="right">这里是内容</div>
</div>
<div class="foot"></div>
</body>
</html>

时间: 2024-10-29 00:04:29

吸顶条或者其他的吧的相关文章

进度条、输入框文字提示、图片延迟加载、吸顶条

进度条:                            window.onload=function(){                                            var oBox1=document.getElementById("box1");                                            var oBox2=document.getElementById("box2");      

吸顶条 ---- jQ写法

<script> $(function () { var barTop = $('#bar').offset().top; //on方法相当于原生的绑定 $(window).on('scroll',function () { var scrollTop = $(document).scrollTop(); if (scrollTop >= barTop) { //固定在上方 $('#bar').css({position: 'fixed',top: 0}); // 显示替代的条 $('#

面向对象吸顶条

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> *{margin:0;padding:0;} .Suction_cap{width:100%;height:100px;overflow:hidden;background:skyblue;} .mai

吸顶条+大图加载滚动

<!doctype html><html><head><meta charset="utf-8"><title>无标题文档</title><style>*{margin:0;padding:0;}.box{ position:relative;padding:50px; border-bottom:1px solid red;}.box img{ display:block;width:1200px;h

原生js吸顶式导航条

<!--吸顶式导航条--><nav class="nav"> <div> <a href="javascript: return false"><img src="n.jpg" ></a> <div class="topNav"> <div> <input type="text" placeholder=&

原生js实现吸顶导航和回到顶部特效

1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>吸顶导航特效</title> 6 <style type="text/css"> 7 body{ 8 margin: 0; 9 padding: 0; 10 } 11 .main{ 12 width: 10

js实现导航栏的吸顶操作

1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 3 4 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 5 <html> 6 <head> 7 <style type="text/css&

代码:jquery 吸顶 效果

(只是个简单吸顶效果,还需完善) 吸顶: <script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script> <script type="text/javascript"> $(function(){ $(window).scroll( function() { var m =$(document).scrollTop(); console.log(

status bar、navigationBar、tableView吸顶view设置

1. 隐藏navigationBar self.navigationController.navigationBar.hidden = YES; 2. status bar设置 -(void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent; } -(void)v