views:

346

answers:

1

Hi all, The function given below is working fine but over i want to amke every elemnt that i drop a s resizable but as soon as i double click that element it's resizable property is lost. How can i resolve it?

function dropTag(tag){
    var box = "";

    var hashtag = "#"+tag;
    $(hashtag).draggable({
        helper:'clone'
    });
    //  alert("tag0:"+tag+"box:"+box);

    $('#droppable').droppable({
        drop: function(ev,ui){
            var tmp = $(ui.draggable).attr("id");
            //    alert("in droppable1:"+tmp);
            //    alert("tag:"+tag+"box:"+box);
            if (tmp=="TaskName_div"){
                box= '<div id="TaskName_dummy'+count3+'" class ="TaskName_div_dummy" ondblclick="EditText(this.id);" >'+
                '<input type=checkbox id="task_name_checkbox_dummy'+count3+'"/>'+
                'Task dummy</div>';
                count3++;
            }
            if (tmp=="Normal_Tag2_div"){
                box = '<div id="Normal_Tag2_div_dummy'+count2+'"class ="Normal_Tag2_div_dummy" ondblclick="EditText(this.id);">'+ WM_LANG_NORMAL_TAG2+'</div>';
                count2++;

            }
            if (tmp=="Normal_Tag1_div"){
                box = '<div id="Normal_Tag1_div_dummy'+count1+'"class ="Normal_Tag1_div_dummy" ondblclick="EditText(this.id);">'+WM_LANG_NORMAL_TAG+ '</div>';

                count1++;

            }
            //    alert("tmp:"+tmp+"box:"+box);
            if(($(ui.draggable).attr("id")).indexOf("dummy",0)==-1){
                $(box)
                .appendTo('#droppable' )
                .draggable({
                    collide: 'block',
                    revert: 'invalid'
                }).resizable({
                    resize:function(ev,ui)
                    {
                        tag_width=ui.size.width;
                        tag_height=ui.size.height;
                    }
                }).dblclick(function (ev,ui)
                {
                    var response = $.ajax({
                        type:"POST",
                        url: "grabImage.php",
                        data:"name=John&location=Boston&function_name=img",
                        complete: function(msg){
                            var resp = msg.responseText;
                            if(msg && msg.readyState != 4) {
                                alert("Ready State :"+msg.readyState); return;
                            }
                            else{
                                //wb_load();
                                alert( "Data Saved: " + resp);

                            }
                        }
                    });

                }
                );
                tag_left=(ui.position.left);
                tag_top=(ui.position.top);
            //alert(tag_left+";"+tag_top);
            //tag_height=ui.originalSize.height;
            // tag_width=ui.originalSize.width;
            //alert(tag_width);
            //alert("tag_left"+tag_left+"tag_top"+tag_top+"tag_height"+tag_height+"tag_width"+tag_width);
            }
            else{
                //     alert("not dropped:"+tag);
                tag_left=(ui.position.left);
                tag_top=(ui.position.top);
            //alert(tag_left+";"+tag_top);
            //tag_height=ui.originalSize.height;
            //tag_width=ui.originalSize.width;
            //alert("tag_left"+tag_left+"tag_top"+tag_top+"tag_height"+tag_height+"tag_width"+tag_width);
            }
        }
    });
}
A: 

This works

 $(function() {
      $('#frame img').live('mousemove', function(event) {
      $('#frame img').resizable().parent().draggable(); 
      });
  });
Vani