zoukankan      html  css  js  c++  java
  • 大图 预览

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>Explaining the Document Object Model</title>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
            <script>
                    $(function(){
                            var x = 10;
                            var y = 20;
                            $("a.tooltip").mouseover(function(e){
                                    this.myTitle = this.title;
                                    this.title = "";
                                    var imgTitle = this.myTitle ? "<br />" + this.myTitle +" 产品预览图" : "";
                                    var tooltip = "<div id='tooltip'><img src='"+this.href+"' alt='产品预览图' width='500' height='500' />"+imgTitle+"</div>";
                                            $("body").append(tooltip);
                                            $("#tooltip")
                                                    .css({
                                                            "top": (e.pageY+y) + "px",
                                                            "left":(e.pageX+x) + "px"
                                            }).show("fast");
                            }).mouseout(function(e){
                                    this.title = this.myTitle;
                                    $("#tooltip").remove();
                            }).mousemove(function(e){
                                    $("#tooltip").css({
                                            "top": (e.pageY+y) + "px",
                                            "left": (e.pageX+x) + "px"
                                    });
                            });
                    })
            </script>
            <style>
                    ul{margin: 30px auto; 1440px;}
                    ul li{float: left; padding-right: 50px; list-style: none;}
                    ul li img{ 100px; height: 100px; padding: 10px; border: 1px solid #ccc; background-color:#eee; -webkit-border-radius: 8px;}
                    #tooltip{
                            position: absolute;
                            background-color: #eee;
                            border: 1px solid #999;
                            500px;
                            height: 520px;
                            -webkit-border-radius: 8px;
                            font-family: "微软雅黑";
                            padding: 20px;
                    }
            </style>
      </head>
      <body>
            <ul>
                    <li><a href="images/imac.jpg" title="苹果 iMac" class="tooltip"><img src="images/imac.jpg" alt="苹果 iMac" /></a></li>
                    <li><a href="images/iphone.jpg" title="苹果 iPhone" class="tooltip"><img src="images/iphone.jpg" alt="苹果 iPhone" /></a></li>
                    <li><a href="images/sb.jpg" title="苹果 鼠标" class="tooltip"><img src="images/sb.jpg" alt="苹果 鼠标" /></a></li>
                    <li><a href="images/jp.jpg" title="苹果 键盘" class="tooltip"><img src="images/jp.jpg" alt="苹果 键盘" /></a></li>
            </ul>
      </body>
    </html>
  • 相关阅读:
    8.图片切换
    6.节点的访问关系和操作
    4.京东狗
    3.关闭京东广告栏
    1.事件的拓展
    小飞鸟 小游戏
    网页特效(旋转木马轮播图)
    时间转换
    深入理解css3中的flex-grow、flex-shrink、flex-basis
    VUE 使用插件vue-clipboard2复制内容至剪切板(两种使用方法)
  • 原文地址:https://www.cnblogs.com/lgzh3/p/2373249.html
Copyright © 2011-2022 走看看