zoukankan      html  css  js  c++  java
  • 简单文本悬浮div提示效果

    <html>
    <head>
        <script src="jquery-1.9.1.min.js" type="text/javascript"></script>
        <script>
            $(document).ready(function() {
                $("a").each(function() {
                    $(this).mouseover(function() {
    
                        $(this).next("div").css("left", function() {
                            return $(this).prev("a").offset().left - $(this).width();
                        });
                        $(this).next("div").css("top", function() {
                            return $(this).prev("a").offset().top;
                        })
    
                        var str = "";
                        str += "<div style='color:red;'><ul style='100%; margin-left:0;'><li style='float:left; 50%;'>11</li><li style='float:left; 30%;'>33</li><li style='float:left; 15%;'>55</li></ul></div/>";
                        str += "<div style='color:blue;'><ul style='100%; margin-left:0;'><li style='float:left; 50%;'>22</li><li style='float:left; 30%;'>44</li><li style='float:left; 15%;'>66</li></ul></div/>";
                        $("a").each(function() {
                            $(this).next("div").html(str);
                        });
                        
                        $(this).next("div").toggle();
                    });
                    
                    $(this).mouseout(function() {                    
                        var id = $(this).prev("input[type='hidden']").prev("input[type='hidden']").val();
                        $(this).next("div").toggle();
                    });
    
                });
            });
        </script>
    </head>
    <body>
    <div>
        <div style="900px;float:left;">
            test tooltip
        </div>
        <div style="float:left;">
            <table>
                <tr><td>
                    <a>1111111</a>
                    <div style="position: absolute; top: 200; left: 300; display: none;  560; height: auto;
                        background-color: yellow; color: Black; border: solid  black  1px;" id="floatDIV">
                    </div>
                </td></tr>
                <tr><td>
                    <a>2222222</a>
                    <div style="position: absolute; top: 200; left: 300; display: none;  560; height: auto;
                        background-color: yellow; color: Black; border: solid  black  1px;" id="floatDIV">
                    </div>
                </td></tr>
            </table>
            
            
        </div>
    </div>
    </body>
    </html>

  • 相关阅读:
    百度文库文档下载分析
    旅游公司招聘Java工程师
    C# 在Repeater 的ItemDataBound 如何转换e.Item.DataItem 的类型
    IOS多线程GCD
    vDSP加速的应用
    ios获取内核数目
    Struts06---通配符的使用
    Struts05---动态查询
    Struts04---命名空间的查询顺序以及默认执行的Action
    Struts03---参数传递
  • 原文地址:https://www.cnblogs.com/linxianfeng/p/4938560.html
Copyright © 2011-2022 走看看