Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无法在Internet Explorer 10中使用JQuery更新偏移量_Javascript_Jquery_Html_Css_Internet Explorer - Fatal编程技术网

Javascript 无法在Internet Explorer 10中使用JQuery更新偏移量

Javascript 无法在Internet Explorer 10中使用JQuery更新偏移量,javascript,jquery,html,css,internet-explorer,Javascript,Jquery,Html,Css,Internet Explorer,我试图设置元素的偏移量。 代码在Chrome中运行正常,但我无法在IE中获得更改的偏移量 this.moveH = function (e) { if (this.target != null){ console.log(this.target.offset()) this.target.offset({ left: e.pageX - this.target.outerWidth(true) / 2, t

我试图设置元素的偏移量。 代码在Chrome中运行正常,但我无法在IE中获得更改的偏移量

this.moveH = function (e) {

    if (this.target != null){
        console.log(this.target.offset())
        this.target.offset({
            left: e.pageX - this.target.outerWidth(true) / 2,
            top: e.pageY - this.target.outerHeight(true) / 2
        });
    }
    console.log(this.target.offset())
    e.preventDefault();
}
如果在chrome中运行,则第一个console.log与第二个不同。如果我跑进去,它永远不会改变。 多谢各位

更新1 偏移量函数是来自JQuery的函数

更新2添加了HTML和CSS

*{
    margin:0px;
    left:0px;
    right:0px;
}
#applet {
    position: absolute;
    width: 700px;
    height: 520px;
    direction:ltr;
    text-align: center;
}
#puzzle{
    top:80px;
    left:20px;
    position:absolute;
}

.left-column{
    position:absolute;
    width:388px;
}

.left-puzzle{
    margin-top:10px;
    width:388px;
    background-image:url("../images/left_puzzle.png");
    height:83px;
}
.left-puzzle p{
    margin-right:194px;
}

.right-column{
    float:right;
    left:500px;
    width:182px;
    margin-right:10px;
}
.targets{
    left:206px;
    top:1px;
    width:194px;
    position:absolute;
}
.target{
    margin-top:10px;
    width:194px;
    height:83px;
}
.right-puzzle{
    margin-top:10px;
    width:182px;
    height:82px;
    background-image:url("../images/right_puzzle.png")
}

#bg{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
HTML


在2015年6月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月月日日日日日日日日日日日日日日日日日日日日日日日日日日,,,,在在在在在各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各各图图图图图图图图图图图图图图图图图图图图图图图图图ط

在2016年5月月上,在2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自سرححب㶇شكي

在1578 8月月的1578日日,在1578 8月月月月15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 1606年

Ÿ

㶕㶕㶕㶕㶕㶕㶕و

الذيل

ا

ا


尝试改用本机javascript。
使用obj.offsetLeft和obj.offsetTop。它也应该在IE中工作。在我看来,这是一个跨浏览器的问题

函数offset()是如何定义的?我的错,是JQuery offset函数。你是否尝试使用开发工具,一步一步地查看哪里出了问题?@Huangism我没有发现任何错误。好的,在IE中记录偏移量时,它保持不变,但在Chrome、Firefox和Safari中可以工作如果你使用开发工具,假设您在桌面上,您可以在js中设置断点,并在浏览器执行时查看代码的每个步骤。如果您不在桌面上,那么它可能与缩放有关。快速的谷歌搜索将在缩放时为ie10补偿问题提供一些不错的结果
<div id='applet'>
            <img id='bg' src='images/background.jpg' />
            <div id="puzzle">

                <div class="left-column">

                    <div class="left-puzzle">
                        <p>يبدأ خلف الشرج ولدى بعض الحبليات ذيل يوجد في مرحلة الجنين فقط.</p>
                    </div>

                    <div class="left-puzzle">
                        <p>يمتد بطول الظهر وهو مليء بالسائل عند الفقاريات ويطلق عليه اسم الحبل الشوكي .</p>
                    </div>

                    <div class="left-puzzle">
                        <p>تتطور إلى خياشيم أو إلى أجزاء أخرى من الجسم أثناء تطور الجنين .</p>
                    </div>

                    <div class="left-puzzle">
                        <p>قضيب صلب لكنه مرن يدعم الجسم وفي الفقاريات يحل محله عمود فقري .</p>
                    </div>
                </div>
                <div class="targets">
                    <div class="target drop" id="t1"></div>
                    <div class="target drop" id="t2"></div>
                    <div class="target drop" id="t3"></div>
                    <div class="target drop" id="t4"></div>
                </div>
                <div class="right-column">
                    <div id="d1" class="right-puzzle drag" data-target-id="t2">
                        <p>الحبل العصبي المجوف</p>
                    </div>
                    <div id="d2" class="right-puzzle drag" data-target-id="t1">
                        <p>الذيل</p>
                    </div>
                    <div id="d3" class="right-puzzle drag" data-target-id="t3">
                        <p>الجيوب البلعومية </p>
                    </div>
                    <div id="d4" class="right-puzzle drag" data-target-id="t4">
                        <p>الحبل الظهري</p>
                    </div>
                </div>
            </div>
        </div>