2017-06-17 142 views
0

我创建的日历按照图像1所以我的问题是我想创建onclick div在div上重叠即ie如果点击00:00列比创建div从00:00至07:00开始8小时。如何创建onclick div在多个div上重叠使用jquery

图片1enter image description here

所以,请指引我这件事。什么是更好的解决方案

已经使用拖放分配事件给员工。 我想创建重叠股利如下图像2 enter image description here 这的onclick DIV创建

$("body").on("mousedown", ".Dropabletd", function() { 
     Myleft = $(this).position().left; 
     Mytop = $(this).position().top; 
     $(this).append("<div class='dynatext label' id='divId'>J'e Divs Created</div>"); 
     $("#divId").css({zIndex: 999,position: "absolute", top: Mytop, left: Myleft, width: '100%', display: "block"}); 
    }); 

,那是我的拖动功能。

function Dragging() { 
    $("body .label").draggable({ 
     revert: "invalid" 
    }); 
    $("body .Dropabletd").droppable({ 
     accept: ".label", 
     drop: function (e, ui) { 
      ui.draggable.appendTo($(this)).css({ 
       top: "0.4em", 
       left: "0.2em", 
       width: "100%", 
       display: "block" 

      }); 
      updateEvents($(this).find('span:last-child').attr("id"), $(this).attr("id")); 
     } 
    }); 
} 

回答

0

没有哥们回答我感谢您的,因为我觉得我的自我和学习。 任何变化,建议最受欢迎尊敬的先生/夫人

$("body").on("dblclick", ".Dropablesub_td", function() { 
      var hidid = $(this).attr("id"); 
      var Myleft = $(this).position().left; 
      var Mytop = $(this).position().top; 
      var id = $(this).parent().nextAll().eq($(this).parent().index() + 8).attr("id"); 
      if ($(this).parent().index() > 16) { 
       var widths = "100%"; 
      } else { 
       var widths = $(this).parent().width() * 8; 
      } 
      var heights = $(this).height(); 
      $(this).html("<span id='" + hidid.replace(":", "_") + "' class='divId label label-success unselectable' >ABCDEFGHIJKLMNOPQRSTUVWXYZ<span>"); 
      $(this).children().css({zIndex: 999, position: "absolute", top: Mytop, left: Myleft, width: widths, height: heights, display: "block", border: "#808080 solid 2px", color: "black", background: "#00CEB4"}); 
      $(".divId").resizable({ 
       handles: 'w' 
      }); 
      Dragging2(); 
     });