碌木
小狐狸
小狐狸
  • UID34074
  • 注册日期2010-09-22
  • 最后登录2010-09-22
  • 发帖数1
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
阅读:5467回复:0

有关使用ondrag方法拖动浮动图片(或链接)在FIREFOX下出现虚影的问题

楼主#
更多 发布于:2010-09-22 23:14
由于标题能输入的文字较短,请原谅该标题有30%标题党成分

================十分郁闷的分割线=================

详细问题已经附件中的截图和注释清楚了
rar文件无法上传?

================十分郁闷的分割线=================

十分想知道的问题:怎么能body有其他内容时,图片不缩小的情况下,不出现虚影呢?
或者谁来解释下firefox做这个虚影的用意?

================十分郁闷的分割线=================
由于没办法上传rar打包测试用的网页(还是一个贴只能有三个附件?),测试的请把图片放好再测试....
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
<style>
#imgg{color:#000;position:absolute;cursor:move;background:#fff;outline:none;font-size:12px;}
#imgg img{border:none;}
    </style>
</head>
<body ondblclick="imgg.style.display='';">
body出现内容内容内容
<div id="debug" style="width:100px;position:absolute;background:#fff;z-index:999;"></div>

<a id="imgg" style="top:50px;left:50px;padding:10px;border:solid 3px red;" href="javascript:"></a>

    <script>
        var x, y, imgg = document.getElementById("imgg");
        moveimg();
        function moveimg() {
            with (imgg) {
                innerHTML = "<img src=\"2.jpg\" style=\"border:none;\" draggable=\"true\"/><br/>12312312312312313"
                ondragstart = function(e) { e = e ? e : window.event; x = e.clientX - parseInt(this.style.left); y = e.clientY - parseInt(this.style.top); }
                onclick = function() { this.style.display = "none"; }
                ondragover = function(e) {
                    e = e ? e : window.event;
                    this.style.left = e.clientX - x + "px";
                    this.style.top = e.clientY - y + "px";
                }
            }
        }
    </script>
</body>
</html>
游客

返回顶部