[英]How to make “Stay-On-Top” Menu in IE6 and above?
I want to make menu on top with fixed position and content scroll enable in IE6 and above. 我想使菜单在顶部具有固定位置,并且在IE6及更高版本中启用内容滚动。 I have tried with jsfiddle.net code but it has css property position:fixed;
我已经尝试过jsfiddle.net代码,但是它具有CSS属性position:fixed; which is not supporting to IE6.
IE6不支持。
sample code 样例代码
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Dynamic Top Menu Positioning - jsFiddle demo</title>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.8.3.js'></script>
<link rel="stylesheet" type="text/css" href="/css/normalize.css">
<link rel="stylesheet" type="text/css" href="/css/result-light.css">
<style type='text/css'>
.menu {
background:#345;
color:#FFF;
height:2em;
padding:.5em;
position:absolute;
top:50px;
width:100%;
}
.fixed {
position:fixed;
top:0;
}
</style>
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
/* Dynamic top menu positioning
*
*/
var num = 50; //number of pixels before modifying styles
$(window).bind('scroll', function () {
if ($(window).scrollTop() > num) {
$('.menu').addClass('fixed');
} else {
$('.menu').removeClass('fixed');
}
});
//USE SCROLL WHEEL FOR THIS FIDDLE DEMO
});//]]>
</script>
</head>
<body>
<div class="menu">Menu</div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />(Bottom!)
</body>
</html>
Below links not supporting for IE6 scroll-fix-header-jquery-facebook and nagging-menu-with-css3-and-jquery 下面的链接不支持IE6 scroll-fix-header-jquery-facebook和nagging-menu-with-css3-and-jquery
Could anyone help me to achieve this in IE6 and above 谁能帮助我在IE6及更高版本中实现这一目标
我已经从IE6中的网站Fixed Position DIV获得了解决方案
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.