javascript - 如何获得菜单的 Tololtip Tail

标签 javascript jquery html css tooltip

HTML

<div id="MyForm">
    <a> <img src="ImageMenu.png" /></a>
    <ul>
        <li>
            <a class="selected" href="#">One</a>
        </li>
        <li>
            <a href="#">Two</a>
        </li>
        <li>
            <a href="#">Three</a>
        </li>
    </ul>
</div>

单击 ImageMenu.png 时,我使用 JQuery 显示菜单。如何使用 CSS 获取 Menuimage 正下方的 Tooltip tail(向上箭头)?

最佳答案

我觉得你看起来像这样......

  • 我的形象
    • > 一
    • > 二
    • > 三
  • CSS 包含...

    我的菜单

    { 向左飘浮; 高度:30px; 填充:0 15px; 颜色:#222; 文本转换:大写; 字体:粗体 12px/25px Arial,Helvetica; 文字修饰:无; 文字阴影:0 1px 0 #000;

    mymenu li:hover > a

    { 颜色:#222;

    html #mymenu li a:hover/ IE6 */ { 颜色:#222;

    mymenu li:hover > ul

    { 显示:阻止!重要;

    /* 子菜单 */

    #mymenu ul
    {
        list-style: none;
        margin: 0;
        padding: 0;    
        display: none !important;
        position: absolute;
        top: 25px;
        width:150px;
        z-index: 99999;    
        background: #fff;
        background: -moz-linear-gradient(#555, #888);
        background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #888),color-stop(1, #555));
        background: -webkit-linear-gradient(#555, #888);    
        background: -o-linear-gradient(#555, #888); 
        background: -ms-linear-gradient(#555, #888);    
        background: linear-gradient(#555, #888);
        -moz-box-shadow: 0 0 2px rgba(255,255,255,.5);
        -webkit-box-shadow: 0 0 2px rgba(255,255,255,.5);
        box-shadow: 0 0 2px rgba(255,255,255,.5);   
        -moz-border-radius: 5px;
        border-radius: 5px;
    }
    
    
    #mymenu ul li
    {
        float: none;
        margin: 0;
        padding: 0;
        display: block;  
        -moz-box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
        -webkit-box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
        box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
    }
    
    #mymenu ul li:last-child
    {   
        -moz-box-shadow: none;
        -webkit-box-shadow: none;
        box-shadow: none;    
    }
    
    #mymenu ul a
    {    
        padding: 7px !important;
        height: 10px;
        width: 135px;
        height: auto;
        line-height: 1.8em !important;
        text-decoration: none !important;
        font-weight:normal;
        display: block;
        white-space: nowrap;
        float: none;
        color:#fff;
        text-transform: none;
        text-align:left;
    
    }
    
    *html #mymenu ul a /* IE6 */
    {    
        height: 10px;
    }
    
    *:first-child+html #mymenu ul a /* IE7 */
    {    
        height: 10px;
    }
    #mymenu ul a:hover
    {
        background: #d7d7d7;
        background: -moz-linear-gradient(#d7d7d7,  #d7d7d7);    
        background: -webkit-gradient(linear, left top, left bottom, from(#d7d7d7), to(#d7d7d7));
        background: -webkit-linear-gradient(#d7d7d7,  #d7d7d7);
        background: -o-linear-gradient(#d7d7d7,  #d7d7d7);
        background: -ms-linear-gradient(#d7d7d7,  #d7d7d7);
        background: linear-gradient(#d7d7d7,  #d7d7d7);
        color:#222;
        text-shadow: none;
        font-weight:bold;
        border-bottom:#222;
    }
    #mymenu ul li:first-child > a
    {
        -moz-border-radius: 5px 5px 0 0;
        border-radius: 5px 5px 0 0;
    }
    
    #mymenu ul li:first-child > a:after
    {
        content: '';
        position: absolute;
        left: 30px;
        top: -8px;
        width: 0;
        height: 0;
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-bottom: 8px solid #444;
    }
    
    #mymenu ul li:first-child a:hover:after
    {
        border-bottom-color: #d7d7d7; 
    }
    
    #mymenu ul li:last-child > a
    {
        -moz-border-radius: 0 0 5px 5px;
        border-radius: 0 0 5px 5px;
    }
    

    工作演示:http://jsfiddle.net/nPeaV/7430/

    关于javascript - 如何获得菜单的 Tololtip Tail,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19180159/

    相关文章:

    javascript - Mootools选择器问题

    javascript - Angular 6 - 为不同的布局提供不同的脚本和样式

    javascript - 如何从一个函数调用clearInterval()方法来停止另一个函数中的setInterval()方法

    html - div内的图像在图像下方有额外的空间

    PHP json_encode 转 JS

    javascript - AngularJS Controller 在后端数据更改时自动更新 $scope

    javascript - jQuery 选择动态创建的 html 元素

    javascript - Bootstrap 轮播内容淡入淡出

    javascript - Jquery Slider 不适用于移动设备

    html - 自定义导航和悬停时显示子菜单的问题