[Web]经典下拉菜单

HTML+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 >
    
< title > 工具条上的弹出式菜单 </ title >
    
< style  type ="text/css" >


.MenuItem
{
    display
:block;
    width
:60px;
    height
:20px;
    font-size
: 12px;
    float
:left;
    text-align
:center;
    cursor
: hand;
    padding
:2px 0px 0px 0px;
}


</ style >

    
< script  type ="text/javascript" >

    
var popup = window.createPopup();
    
var width;
    
var height;
    
    
function Pop_menu(divMenuList,width,height,toolbarMenuItem)
    
{
        popup.document.body.innerHTML 
= divMenuList.innerHTML;
        
        popup.show(
0,22,width,height,toolbarMenuItem);  
        
        
// 0 和 23 是相对于toolbarMenuItem元素左上角的坐标点(x,y)
        // width 显示菜单的宽度
        // height 显示菜单的高度
        // toolbarMenuItem 要弹出菜单的对象
        
    }


    
</ script >

</ head >
< body >
    
<!-- 菜单条 -->
    
< div  id ="toolbar_menu"  style ="width: 100%; height: 20px; background-color: #ece9d8;
        border: darkgray 1px solid;"
>
        
<!-- 菜单元素 -->
        
< div  id ="MenuItem1"  class ="MenuItem"  
            onmousemove
="this.style.color='#FFFFFF'; this.style.background='#4169e1';Pop_menu(filMenuList,120,122,MenuItem1)"
            onfocus
="this.style.color='#FFFFFF'; this.style.background='#4169e1';Pop_menu(filMenuList,120,122,MenuItem1)"
            onmouseout
="this.style.color='black';this.style.background='#ece9d8'"
            onfocusout
="this.style.color='black';this.style.background='#ece9d8'"  
            accesskey
="F" > 文件( < u > F </ u > ) </ div >
        
        
        
< div  id ="MenuItem2"  class ="MenuItem"
            onmousemove
="this.style.color='#FFFFFF'; this.style.background='#4169e1';Pop_menu(filMenuList,120,122,MenuItem2)"
            onfocus
="this.style.color='#FFFFFF'; this.style.background='#4169e1';Pop_menu(filMenuList,120,122,MenuItem2)"
            onmouseout
="this.style.color='black';this.style.background='#ece9d8'"
            onfocusout
="this.style.color='black';this.style.background='#ece9d8'"  
            accesskey
="E" > 编辑( < u > E </ u > ) </ div >
        
        
        
< div  id ="MenuItem3"  class ="MenuItem"
            onmousemove
="this.style.color='#FFFFFF'; this.style.background='#4169e1';Pop_menu(filMenuList,120,122,MenuItem3)"
            onfocus
="this.style.color='#FFFFFF'; this.style.background='#4169e1';Pop_menu(filMenuList,120,122,MenuItem3)"
            onmouseout
="this.style.color='black';this.style.background='#ece9d8'"
            onfocusout
="this.style.color='black';this.style.background='#ece9d8'"  
            accesskey
="V" > 视图( < u > V </ u > ) </ div >
        
        
        
< div  id ="MenuItem4"  class ="MenuItem"
            onmousemove
="this.style.color='#FFFFFF'; this.style.background='#4169e1';Pop_menu(filMenuList,120,122,MenuItem4)"
            onfocus
="this.style.color='#FFFFFF'; this.style.background='#4169e1';Pop_menu(filMenuList,120,122,MenuItem4)"
            onmouseout
="this.style.color='black';this.style.background='#ece9d8'"
            onfocusout
="this.style.color='black';this.style.background='#ece9d8'"  
            accesskey
="S" > 网站( < u > S </ u > ) </ div >
        
< div  style ="clear: both;" >
        
</ div >
    
</ div >
    
    
    
    
< div  style ="width: 100%; height: 200px; background-color: #cccc99;" ></ div >
    
    
    
    
<!-- 文件菜单 -->
    
< div  id ="filMenuList"  style ="display: none;" >
    
    
        
<!-- 菜单列表元素 -->
        
< div  style ="width: 120px; height: auto; background-color: #eee; border: darkgray 1px solid;" >
            
            
            
< div  onmousemove ="this.style.color='white'; this.style.background='#4169e1';"  onmouseout ="this.style.color='black';this.style.background='#eee'" >
                
< span  onclick ="parent.location.href='http://blog.csdn.net/qghboy'"  style ="cursor: hand;
                    height: 20px; font-size: 12px; padding: 5px;"
> 我的CSDN博客 </ span >
            
</ div >
            
< div  onmousemove ="this.style.color='white'; this.style.background='#4169e1';"  onmouseout ="this.style.color='black';this.style.background='#eee'" >
                
< span  onclick ="parent.location.href='http://blog.csdn.net/qghboy'"  style ="cursor: hand;
                    height: 20px; font-size: 12px; padding: 5px;"
> 我的CSDN博客 </ span >
            
</ div >
            
< div  onmousemove ="this.style.color='white'; this.style.background='#4169e1';"  onmouseout ="this.style.color='black';this.style.background='#eee'" >
                
< span  onclick ="parent.location.href='http://blog.csdn.net/qghboy'"  style ="cursor: hand;
                    height: 20px; font-size: 12px; padding: 5px;"
> 我的CSDN博客 </ span >
            
</ div >
            
< div  onmousemove ="this.style.color='white'; this.style.background='#4169e1';"  onmouseout ="this.style.color='black';this.style.background='#eee'" >
                
< span  onclick ="parent.location.href='http://hexun.com/qghboy'"  style ="cursor: hand;
                    height: 20px; font-size: 12px; padding: 5px;"
> 我的和讯博客 </ span >
            
</ div >
            
< div  onmousemove ="this.style.color='white'; this.style.background='#4169e1';"  onmouseout ="this.style.color='black';this.style.background='#eee'" >
                
< span  onclick ="parent.location.href='http://hexun.com/qghboy'"  style ="cursor: hand;
                    height: 20px; font-size: 12px; padding: 5px;"
> 我的和讯博客 </ span >
            
</ div >
            
            
        
</ div >
        
        
    
</ div >
</ body >
</ html >
HTML5 汉堡式弹出菜单示例.rar HTML5基于jQueryPopMenu插件的堡式弹出菜单示例,本菜单主要面向移动设备,比如手机浏览器,ipad、平板电脑等设备的浏览界面中,因节约屏幕空间,又很美观,当手触的时候才会显示出菜单内容,不操作时候,像个汉堡一样叠在屏幕角落,当然,如果你喜欢,你完全可以应用到你的网页中。 立即下载

相关推荐

向上弹出式菜单(css+js)

一个简单的向上弹出式菜单! 当鼠标移到上面后显示菜单, 当鼠标移开后不显示菜单! 达到一个隐藏的效果!

Html做弹出式菜单,微信小程序实现炫酷的弹出式菜单特效

今天给大家带来一个微信小程序的弹出是菜单效果,老规矩先上效果图。(录制的gif动画有点卡,实际真机或是模拟器上很顺畅)先简单说下思路:1、首先在屏幕的某个位置放几个悬浮按钮,放几个看你需要的功能2、点击最上层(wxml中最后一个就是最上层)的的按钮后增加背景遮罩,这个遮罩在我前面自定义modal弹框时有用到3、分别对按钮做旋转和移动动画和透明度,造成动画差异就是位移的动画距离不同4、收起的时候回到...

weixin_42242323的博客 1365

HTML实现右键菜单

jQuery 右键菜单 HTML右键菜单 javascript 右键

Html做弹出式菜单,JavaScript制作的可折叠弹出式菜单示例

可折叠弹出式菜单body {background-color: #FFF;color: #000;}div {margin-bottom: 10px;}ul.menu {display: none;list-style-type: none;margin-top: 5px;}a.menuLink {font-size: 16px;font-weight: bold;}window.onload =...

weixin_42351910的博客 586

html点击出现表单弹窗

在系统中,点击某个按钮如何弹出一个**表单弹窗**并且设置**遮罩层**,如下图所示。

lplovewjm的博客 1万+

陈表达学html-弹出显示下拉菜单-窗口案例

【代码】陈表达学html-弹出显示下拉菜单-窗口案例。

陈表达的博客 1094

如何使用React95:打造怀旧Windows 95风格的现代React应用

React95是一个基于React的组件库,它能帮助开发者轻松创建具有Windows 95风格UI的现代Web应用。通过这个强大的工具,你可以快速实现经典的Windows 95界面元素,为你的项目增添独特的怀旧感。 ## 什么是React95? React95是一个开源的React组件库,它复刻了Windows 95操作系统的经典UI设计。这个项目将复古的界面风格与现代的Web开发技术相结合,

gitblog_00561的博客 342

如何在Next.js项目中快速集成React95:打造复古Windows 95风格UI的终极指南

React95是一个基于React的组件库,专为创建Windows 95风格的用户界面而设计。本指南将详细介绍如何在Next.js项目中高效集成React95,帮助你轻松实现怀旧风格的现代Web应用。 ## 准备工作:安装React95核心依赖 在开始之前,请确保你的Next.js项目已经正确初始化。通过以下命令安装React95的核心组件和图标库: ```bash npm install

gitblog_00211的博客 785

经典DIV+CSS下拉菜单

符合WEB标准的CSS下拉导航菜单布局及css下拉菜单模板   HTML代码如下 &lt;ul id="nav"&gt; &lt;li&gt;&lt;a href="###"&gt;div+css&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="###"&gt;CSS

7万+

html纵向下拉菜单怎么做,html下拉菜单的实现方式

**方法一:纯css实现下拉菜单**Document*{margin: 0;padding:0;}#nav{/*置父容器高度,宽度,背景颜色,容器水平居中*/background: #eee;width: 600px;height: 40px;margin: 0 auto;}#nav ul{/*去掉点点*/list-style: none;}#nav ul li{/*每一个li左浮动形成横排,高...

weixin_34362937的博客 2076

纯CSS仿经典下拉菜单代码

* {margin:0px;font-size:12px;color:#000000;}hr {color:gray;border:1px inset;}#dyMenu {width:100%;background:#D4D0C8;border:2px outset;float:left;}#dyMenu a {width:60px;text-decoration:none;cursor:defa

Penlee's Blog 1366

javascript弹出式下拉菜单

经典下拉菜单 js多功能下拉菜单 横向下拉菜单html(集合) 全是html+javascript的

js+css实现的简易弹出式菜单(第二版模仿ibm开发中心的菜单)

NULL 博文链接:https://hrtc.iteye.com/blog/261886

web前端实战系列[3]——下拉菜单

1.制作步骤 静态网页动态效果——下拉菜单的显示和隐藏 |---css实现 |---JQuery实现 |---JavaScript实现浏览器兼容性问题 2.html+css实现 <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> ...

weixin_30678349的博客 294

ajax菜单,下拉菜单,下拉框,省市联动终极解决方案(经典收藏)

网站地图:1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465...

weixin_30278237的博客 326

HTML/CSS方法实现下拉菜单

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X...

XDarker的博客 358

快速制作微软风格下拉菜单

本文转载自:http://www.5d.cn/rudolf/web/web-navi1-0.htm网页制作中有一种技术,叫作源代码修改型,也就是将一些高手现成编制好的Javascript源代码进行一些修改,然后复制/粘贴到你的网页中。下文就是一个典型的例子。您甚至不需要知晓该语言,只要您知道一些HTML语言规范,就能快速创建自己又酷又炫的网页特效。说起网页上的下拉菜单,最最经典的就是微软风

cfyy的专栏 1066
上一篇: [Web]Object对象自动最大化窗体
下一篇: [Web]如何利用js库dom-drag.js最简单化实现移动图层和点击实现div居上问题
qghboy
博客等级 码龄21年 22粉丝 42原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值