IBM官网的JS+CSS的导航菜单效果

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>IBM官网的JS+CSS的导航菜单效果丨kiddy官网|聚来宝是真的吗</title>
    <style>
    body,div,ul,li{margin:0;padding:0;}
    body{height:2000px;background:#F0F0F0;}
    li{list-style:none;}
    a:link,a:visited{outline:none;text-decoration:none;}
    #wrap{width:100%;position:fixed;top:0;}
    #topBar{color:#7A7A7A;height:28px;background:#131623;overflow:hidden;font:12px/28px Arial;text-align:center;}
    #topBar a{color:#FFF;background:#7A7A7A;padding:2px 5px;border-radius:10px;}
    #nav{height:50px;overflow:hidden;border-top:1px solid #999;border-bottom::1px solid #666;background:#000 url(/imagesforcode/201204/2011122131216590.png) repeat-x;}
    #nav .logo{float:left;margin:0 20px;}
    #nav .logo a{float:left;width:100px;height:50px;overflow:hidden;text-indent:-9999px;background:url(/imagesforcode/201204/2011122131214364.png) no-repeat;}
    #nav .logo a:hover{background-position:0 -50px;}
    #nav.hide .logo a{width:100px;height:30px;background-position:0 -100px;_background-position:0 -130px;}
    #nav.hide .logo a:hover{background-position:0 -130px;}
    #nav ul,#nav ul li{float:left;}
    #nav ul li a{float:left;color:#CCC;height:50px;font:16px/50px Arial;padding:0 20px;}
    #nav ul li a:hover{color:#FFF;background:url(/imagesforcode/201204/2011122131216590.png) 0 -50px repeat-x;}
    #nav.hide ul{display:none;}
    </style>
    <script>
    var fgm = {
    shit: !-[1,] && !window.XMLHttpRequest,
    scrollTop: function() {
    return document.documentElement.scrollTop || document.body.scrollTop;
    },
    currentStyle: function(obj, attr) {
    return parseInt(obj.currentStyle ? obj.currentStyle[attr] : getComputedStyle(obj, null)[attr]);
    },
    fixed: function(element) {
    if(this.shit) {
    var top = this.currentStyle(element, "top") || 0,
    dd = "(document.documentElement)";
    document.documentElement.style.textOverflow = "ellipsis";
    element.style.position = "absolute";
    element.style.setExpression("top", "eval(" + dd + ".scrollTop + " + (top - this.scrollTop()) + ‘) + "px"‘);
    }
    else {
    element.style.position = "fixed";
    }
    },
    doMove: function(obj, iTarget, callback) {
    clearInterval(obj.timer);
    obj.timer = setInterval(function() {
    var iCur = fgm.currentStyle(obj, "height"),
    iSpeed = (iTarget - iCur) / 5;
    iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);
    iTarget == iCur ? (clearInterval(obj.timer), callback && callback.call(obj)) : obj.style.height = iSpeed + iCur + "px";
    }, 30);
    }
    };
    window.onload = function() {
    var oWrap = document.getElementById("wrap"),
    oTopBar = document.getElementById("topBar"),
    oNav = document.getElementById("nav"),
    fnStatus = function(status) {
    !!status ?
    (function() {
    oNav.className = "hide";
    fgm.doMove(oTopBar, 4);
    fgm.doMove(oNav, 30);
    })() :
    (function() {
    fgm.doMove(oTopBar, 28);
    fgm.doMove(oNav, 50, function() {
    this.className = "" ;
    })
    })();
    };
    fgm.fixed(oWrap);//IE6 Fixed
    window.onscroll = function() {
    var iScrollTop = fgm.scrollTop();
    fnStatus(iScrollTop > 0);
    document.onmouseover = function(ev) {
    var oEv = ev || event,
    oTarget = oEv.target || oEv.srcElement,
    contains = function() {
    if(oWrap.contains) {
    return oWrap.contains(oTarget);
    }
    else if(oWrap.compareDocumentPosition) {
    return !!(oWrap.compareDocumentPosition(oTarget) & 16);
    }
    }();
    fnStatus(!contains && iScrollTop > 0);
    };
    };
    window.onscroll();
    };
    </script>
    </head>
    <body>
    <div id="wrap">
    <!--/topBar-->
    <div id="nav">
    <div class="logo"><a href="javascript:;">IBM</a></div>
    <ul>
    <li><a href="javascript:;">解决方案</a></li>
    <li><a href="javascript:;">服务</a></li>
    <li><a href="javascript:;">产品</a></li>
    <li><a href="javascript:;">支持与下载</a></li>
    <li><a href="javascript:;">个性化服务</a></li>
    </ul>
    </div>
    <!--/nav-->
    </div>
    <!--/wrap-->
    </body>
    </html>
    <br><br><br><br><br><hr>
    
时间: 2024-10-13 21:19:06

IBM官网的JS+CSS的导航菜单效果的相关文章

实用js+css多级树形展开效果导航菜单

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Typ

顶 企业站常用css横向导航菜单

<!DOCTYPE html PUBliC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml</a>" lang="zh-CN"><head><m

js+css实现带缓冲效果右键弹出菜单

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Typ

Web前端开发实战6:CSS实现导航菜单结合二级下拉式菜单的简单变换

前面几篇博文都在讲导航菜单和二级下拉式菜单,其实有很多方法都可以实现的,具体的情况还要视情况而定. 在后面学习到jQuery框架之后,会有更丰富的动画效果,由于在学习Ajax和jQuery的初步阶段,对于很多的复杂的导 航菜单和二级下拉式菜单没法做,但是学习了CSS和JS还是能实现一些简单的变换的.这篇博文就来说说用CSS实现 导航菜单结合二级下拉式菜单的两个简单变换吧. 首先还是在前面博文的基础上加以实现,其实只用HTML和CSS还是可以做出不错的效果,但是相较于JS和 jQuery来说就有很

CSS之导航菜单

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>CSS之导航菜单</title> <link rel="stylesheet" href="http://files.cnblogs.com/files/caidupingblogs/button.min.css"

很酷的伸缩导航菜单效果,可自定义样式和菜单项。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Typ

[Jquery]导航菜单效果-纵向

$( document ).ready( function(e){ var $catCont = $( ".cat-cont" );    //二级菜单div    var $catList = $( ".J_Cat" );       //一级菜单li $catList.on( "mouseenter", function(){ var index = $( this ).index();        var $curCatList = $(

用jQuery制作仿网易云课堂导航菜单效果

最近做项目,用到类似的效果. 效果图如下: 直接上代码: HTML: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> <link rel="stylesheet" href="./css/index.css"> <script s

js实现当前导航菜单高亮显示

为了增加用户体验度,增加网页的易用性和美观度,往往需要把当前导航菜单以特殊方式显示,通常是高亮显示或有不同于其它菜单的背景,有两种方法可以实现,第一种是用纯css来实现,二是用js辅助css来实现,两个种方法都比较简单,相对而言js更简单些,下面介绍用js来实现的方法: 首页假设我们的导航代码是这样写的: <div id="navi"><ul><li><a href="1.html">主页</a></