<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("ul li").each(function (index) {
            $(this).mouseover(function () {
                var obj = $(this).offset();
                var xobj = obj.left + 190 + "px";
                var yobj = obj.top - 50 + "px";
                $(this).css({ "width": "190px", "z-index": "9999", "border-right": "none", "background": "#fff" });
                $("ul > div:eq(" + index + ")").css({ "left": xobj, "top": yobj }).show();
            }).mouseout(function () {
                $("ul > .tips").hide();
                $(this).css({ "width": "200px", "z-index": "1", "border": "1px solid #E5D1A1", "background": "#FFFDD2" })
            })

})
        $("div").each(function () {
            $(this).mouseover(function () {
                $(this).prev("li").css({ "width": "190px", "z-index": "9999", "border-right": "none", "background": "#fff" })
                $(this).show();
            }).mouseout(function () {
                $(this).hide();
                $(this).prev("li").css({ "width": "200px", "z-index": "1", "border": "1px solid #E5D1A1", "background": "#FFFDD2" });
            })
        })
    })
</script>
</head>
<body>
   
<ul>
<li><a href="#">baidu</a></li>
<div class="tips">
<p><a href="http://www.baidu.com">baidu </a></p>

<p><a href="http://www.baidu.com">baidu </a></p>
</div>
<li>goolge</li>
<div class="tips">
<p><a href="http://www.google.com">google</a></p>
<p><a href="http://www.google.com">google</a></p>
</div>
<li>yahoo</li>
<div class="tips">
<p><a href="http://www.yahoo.com">yahoo</a></p>
<p><a href="http://www.yahoo.com">yahoo</a></p>
</div>
<li>microsoft</li>
<div class="tips">
<p><a href="http://www.microsoft.com">microsoft</a></p>
<p><a href="http://www.microsoft.com">microsoft</a></p>
</div>
</ul>

<style type="text/css">
html{color:#666;background:#FFF;}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,i,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}
body{font:12px/1.3 arial,helvetica,clean,sans-serif,\5b8b\4f53;}
h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}
table{border-collapse:collapse;border-spacing:0;}
img{border:none;}
a{text-decoration:none; color:#666;}
a:hover{text-decoration:underline; color:#FF6600;}
ul,li{list-style-type:none;}
q:before,q:after{content:'';}
sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}
/* All reset */
body{ margin:100px;}
ul li{line-height:30px; border:1px solid #E5D1A1; text-align:center; margin-top:-1px; width:200px; background:#FFFDD2; position:relative; z-index:1;}
.tips{position:absolute; width:150px; height:150px; border:1px solid #E5D1A1; background:#fff; z-index:2; display:none;}
</style>
</body>
</html>

转载原文:http://www.jb51.net/article/35992.htm

简单仿京东导航下拉菜单 javascript的更多相关文章

  1. MDNavBarView下拉导航菜单(仿美团导航下拉菜单)

    说到下拉导航菜单这个东西用得还真不少,细心算一下做开发以来这样的菜单已经写了第三次了,但基本都是不能复用.感觉特累人.不经意看到同事写一个类似的下拉菜单,但他引用了开源库仿大众菜单的库,大致看了一下, ...

  2. 纯CSS实现二级导航下拉菜单--css的简单应用

    思想:使用css的display属性控制二级下拉菜单的显示与否.当鼠标移动到一级导航菜单的li标签时,显示二级导航菜单的ul标签.由于实现起来比较简单,所以在这里直接给出了参考代码. 1.纯CSS二级 ...

  3. 用原生JS实现的一个导航下拉菜单,下拉菜单的宽度与浏览器视口的宽度一样(js+html+css)

    这个导航下拉菜单需要实现的功能是:下拉菜单的宽度与浏览器视口的宽度一样宽:一级导航只有两项,当鼠标移到一级导航上的导航项时,相应的二级导航出现.在本案例中通过改变二级导航的高度来实现二级导航的显示和消 ...

  4. jq+css+html简单实现导航下拉菜单

    相信导航栏下拉菜单是web开发最常见的一个item了.这里就不做介绍了,直接上code. Html部分 <div class="_nav"> <ul id=&qu ...

  5. HTML DOM部分---做竖向横向的下拉导航 下拉菜单 图片轮播(圆点、箭头) 选项卡 进度条;

    1,竖向下拉导航 鼠标单击打开 再打击关闭 <style> *{ margin:0px auto; padding:0px;} div{ width:100px; height:50px; ...

  6. 兼容ie7的导航下拉菜单

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  7. 下拉菜单--JavaScript触发方法

    1. $(function(){ $(".dropdown-toggle").one("click",function(){ $(this).dropdown( ...

  8. bootstrap:导航下拉菜单

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name ...

  9. js导航下拉菜单

    使用定时器.鼠标移动事件 var img = $('#user_head'); var menu = $('.nav_list'); var i=0; var timer; img.mouseente ...

随机推荐

  1. des 加密 iOS

    转载请注明原文出处 生成同名的Des.h文件和Des.m文件后,拷贝下方的代码可直接使用.注意在Des.m文件中将key值修改为项目所需的key.--->  #define DesKey 过程很 ...

  2. 移动端开发(四):swiper.js

    swiper.js中文网:http://www.swiper.com.cn/ 文档结构 swiper.jquery.js    是需要引用jquery.js 或者 zepto.js 时,只需直接引用该 ...

  3. ADO接口

    转自百度文库 ADO中最重要的对象有三个:Connection.Recordset和Command,分别表示连接对象.记录集对象和命令对象. 三个对象对应的智能指针分别是:_ConnectionPtr ...

  4. Laravel5 学习与使用(一)

    2015-07-04 (1)  安装Laravel框架 ① 安装前的准备工作 使用Apache24 + PHP 5.6 + MySQL 开发环境完成PHP网站开发,所以Laravel的安装是建立在以上 ...

  5. mysql 查询条件中文问题

    这是mysql字符编码的问题,因为mysql默认的字符编码为latin1它并不识别中文,所以在读取查询语句时会出现乱码 从而使查询条件不正确所以我们只需要更改它的字符编码就可以一般都是用utf8 这里 ...

  6. Hash table in PowerShell

    hashtable is easy to create, access and manipulate. we simply use $hashTable = @{} to create an empt ...

  7. 模拟美萍加密狗--Rockey2虚拟狗(四)

    目录(?)[+]       首先,抱怨一下.学校个破网,似乎把我端口封了,死活分不上IP,也许是是我MAC改的太频繁了,有盗号嫌疑…… 然后,正文开始…… 其实虚拟狗几天前就写完了,可这几天上不了网 ...

  8. ALV的html表头

    在ALV的function的exporting里添加属性: I_CALLBACK_HTML_TOP_OF_PAGE = alv_top_of_page 定义form响应上述ALV属性 *&-- ...

  9. HDU 1720 A+B Coming

    #include <string> #include <cstdio> #include <iostream> using namespace std; int c ...

  10. Swift调用Objective C的FrameWork

    很多Github的库经过很多年的发展,源码都是OC写的,,所以,用Swift调用OC的库就是开发中难免遇到的的一个问题,本文以AFNetworking为例,讲解如何跨语言调用. 第一步 创建一个空的工 ...