我正在使用webkit拖放功能,但在拖动时我正在尝试检索我要删除的特定div的索引
var data = new Array ("a","b","c","d","e","f","g");
var data1 = new Array ("c","b","e","d","a","f","g");
var check ="" ;
var test = "";
var test1 = 0;
var str = "abcdefg";
$(document).ready(function(){
alert("hello");
$('.content').each(function(){
var text1 = $(this).text();
var element = this;
var draggab = new webkit_draggable($(this).attr('id'),{
onStart : function(){
var text1 = $(element).text()
console.log("start"+text1);},
var dropable = webkit_drop.add($(this).attr('id'),{
accept : ['content'],
onDrop:function(){
var thise = $(this);
console.log($(thise).index(this));
console.log("Drop");
alert($('.content').index() )
alert(text1)
alert(data[$('.content').index(this)] == text1);
if(data[$('.content').index(this)] == text1)
{
var condrop=$(this).html()
alert(condrop);
$(element).html(condrop);
$(this).html(text1);
}
},
这里的内容是div id,我想要特定div的索引。
答案 0 :(得分:0)
应该这么简单:
onDrop:function(){
var $this = $(this);
console.log("Drop");
console.log($this.index());
);