调整大小jquery chrome

发布于 2024-08-04 20:23:29 字数 2241 浏览 5 评论 0原文

我有一个问题,我想让一个元素既可拖动又可调整大小。 即使在删除标签后,它也应该可以调整大小。

一些示例代码

function  DivMouseDown(id)
{
  try {
    jQuery('#'+ id).draggable({
    opacity: 0.5,
    revert: 'invalid'
    });
  } catch (e) {
    alert ("exception in DIVmouse down: "+ e);
  }

  try {
    jQuery('#droppable').droppable({
      drop: function(ev,ui) {
        var type = jQuery(ui.draggable).attr("tagtype");
        id = jQuery(ui.draggable).attr("id");
        if(document.getElementById(id) != null) {
          var tagStatus = document.getElementById(id).getAttribute('newtag');
          var idTemp = Math.floor(Math.random()*1000); 

          if(tagStatus == 'new')
          {
            //Create new div at the same place and replace this tag status.
            var divId = document.getElementById(id);
            divId.setAttribute('newtag','old'); 
            divId.setAttribute('id',idTemp);
            CreateWorkboardDiv('html comment', type); 
            jsmarty = WMCreateSmartyObject();
            divValue = WMSmartyFetch(jsmarty, 'edit_menu.tpl');
            document.getElementById(divId.id).innerHTML = divValue;
            jsmarty.clear_all_assign();
            //Open Edit box.
            CollabobaTagCreate(divId.id,type,0);    
          }
          else
          {
            //drag on board  div.
            //Nishima-10-09-09
            var position = new Array();
            position['left'] =  document.getElementById(id).offsetParent.offsetLeft + document.getElementById(id).offsetLeft;
            position['top']   = document.getElementById(id).offsetParent.offsetTop + document.getElementById(id).offsetTop;
            position['width'] =  document.getElementById(id).offsetWidth;
            position['height'] =  document.getElementById(id).offsetHeight;
            position['zindex'] =  jQuery('#' + id).css('zIndex');
            var stickyid = document.getElementById(id).getAttribute('stickyId');  
            UpdateStickyPosition(position,stickyid);
            //Nishima-10-09-09
          }
        }
      }
    });
  }
  catch (e)
  {
    alert ("exception in DIVmouse down: "+ e);
  }
}

谁能告诉我如何使我的元素在删除后可重新调整。在上面的代码标签中,拖放工作完美,但我可以添加什么来使元素在 CHROME 中也可调整大小。

谢谢

I have a problem that i want to make an element draggable and resizable both.
Even after dropping the tag it should be resizable.

Some Sample Code

function  DivMouseDown(id)
{
  try {
    jQuery('#'+ id).draggable({
    opacity: 0.5,
    revert: 'invalid'
    });
  } catch (e) {
    alert ("exception in DIVmouse down: "+ e);
  }

  try {
    jQuery('#droppable').droppable({
      drop: function(ev,ui) {
        var type = jQuery(ui.draggable).attr("tagtype");
        id = jQuery(ui.draggable).attr("id");
        if(document.getElementById(id) != null) {
          var tagStatus = document.getElementById(id).getAttribute('newtag');
          var idTemp = Math.floor(Math.random()*1000); 

          if(tagStatus == 'new')
          {
            //Create new div at the same place and replace this tag status.
            var divId = document.getElementById(id);
            divId.setAttribute('newtag','old'); 
            divId.setAttribute('id',idTemp);
            CreateWorkboardDiv('html comment', type); 
            jsmarty = WMCreateSmartyObject();
            divValue = WMSmartyFetch(jsmarty, 'edit_menu.tpl');
            document.getElementById(divId.id).innerHTML = divValue;
            jsmarty.clear_all_assign();
            //Open Edit box.
            CollabobaTagCreate(divId.id,type,0);    
          }
          else
          {
            //drag on board  div.
            //Nishima-10-09-09
            var position = new Array();
            position['left'] =  document.getElementById(id).offsetParent.offsetLeft + document.getElementById(id).offsetLeft;
            position['top']   = document.getElementById(id).offsetParent.offsetTop + document.getElementById(id).offsetTop;
            position['width'] =  document.getElementById(id).offsetWidth;
            position['height'] =  document.getElementById(id).offsetHeight;
            position['zindex'] =  jQuery('#' + id).css('zIndex');
            var stickyid = document.getElementById(id).getAttribute('stickyId');  
            UpdateStickyPosition(position,stickyid);
            //Nishima-10-09-09
          }
        }
      }
    });
  }
  catch (e)
  {
    alert ("exception in DIVmouse down: "+ e);
  }
}

Can anyone tell me how I can make my element reziable after it is dropped. In the above code tag, dragging and dropping works perfectly, but what can I add to make the element resizable also in CHROME.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文