【发布时间】:2012-05-04 07:07:00
【问题描述】:
我正在使用 UIZE JavaScript 框架在 div 中移动图像元素。这运行正常。
我想让这个功能做另外两件事。
自动重置图像的位置,以防用户将图像拖出边界或根本不允许用户将其拖出边界。
如果用户将图像拖到示例页面上的预定义位置“绿色框”:www.marklaurel.com/sample.php 我想显示一个 div,询问用户是否愿意访问相应图片的网站。
我有这个当前由按钮触发的功能:
<script type="text/javascript">
function snapBack()
{
with (document)
{
getElementById('logoUize').style.left = '133';
getElementById('logoUize').style.top = '6';
getElementById('logoPsd').style.left = '240';
getElementById('logoPsd').style.top = '60';
getElementById('logoAfx').style.left = '240';
getElementById('logoAfx').style.top = '206';
getElementById('logoMaya').style.left = '130';
getElementById('logoMaya').style.top = '237';
getElementById('logoHtml5').style.left = '22';
getElementById('logoHtml5').style.top = '194';
getElementById('logoCss3').style.left = '22';
getElementById('logoCss3').style.top = '48';
}
}
</script>
但是,我从浏览器控制台收到此警告:
Warning: Error in parsing value for 'left'. Declaration dropped.
Source File: http://marklaurel.com/sample.php
Line: 0
Warning: Error in parsing value for 'top'. Declaration dropped.
Source File: http://marklaurel.com/sample.php
Line: 0
能否请我帮我解决这个问题?
【问题讨论】:
-
好的,感谢您指出我的疏忽。现在对于第二部分,定义 div 中间的正方形目标的最佳方法是什么?
标签: javascript html css dom-events javascript-framework