我的页面上有一些拖动元素:
$.when(
// Make an AJAX request.
$.ajax( .. )
// The when block will return the jqXHR Object
// You could also use the $.post() or $.get() methods here.
)
.done(
// any code here will only run if the .when() request is successful
)
.fail(
// Code here will only run if the .when() request fails
)
.always(
// Code placed here will always run. Regardless of success or failure.
// This is usually placed last for additional cleanup, etc. that is
// performed whether the .when() returned success or failure.
)
我使用此代码使它们可拖动:
<h1 id="text1" class="drag" style="top:446.5px; left: 590.5px;">Title</h1>
<img id="img1" src="" data-resize="true" data-src="" class="drag" style="top:446.5px; left: 590.5px;">
当元素只有一个类名时,它可以工作。如果有类似&#34;可拖动的颜色填充&#34;它不起作用。
如何使用多重类名?谢谢你的帮助。
答案 0 :(得分:0)
基本上你可以使用offsetHeight和offsetWidth属性。
https://www.w3schools.com/jsref/prop_element_offsetheight.asp