JQuery鼠标移动上去显示预览图

body中:

 <img src="../images/icon_view.gif" bigimg="../img.jpg" title="查看预览图" class="imgtip" />
<script type="text/javascript">
    //放大图片
    $(function () {
        var x = 10;
        var y = 20;
        $(".imgtip").mouseover(function (e) {
            this.myTitle = this.title;
            this.title = "";
            var imgtip = "<div ><img src='" + $(this).attr("bigimg") + "' width='300' alt='预览图'/><\/div>"; //创建 div 元素
            $("body").append(imgtip); //把它追加到文档中                         
            $("#imgtip")
                .css({
                    "top": (e.pageY + y) + "px",
                    "left": (e.pageX + x) + "px"
                }).show("fast");   //设置x坐标和y坐标,并且显示
        }).mouseout(function () {
            this.title = this.myTitle;
            $("#imgtip").remove();  //移除 
        }).mousemove(function (e) {
            $("#imgtip")
                .css({
                    "top": (e.pageY + y) + "px",
                    "left": (e.pageX + x) + "px"
                });
        });
    });
</script>