简体   繁体   English

如何使用jQuery创建在多个div上重叠的onclick div

[英]how to create onclick div that overlapping on multiple divs using Jquery

i was created calendar as per image 1 so my question is i would like to create onclick div that was overlapping on div ie if click on 00:00 columns than creating div start 00:00 to 07:00 for 8 hours. 我是按照图片1创建日历的,所以我的问题是我想创建在div上重叠的onclick div,即如果单击00:00列而不是创建div,则从00:00到07:00进行8小时。

Image 1 图片1 在此处输入图片说明

So please Just Guide me about this. 因此,请指导我。 what is better solution 有什么更好的解决方案

already using drag and drop for assign events to an employee. 已经使用拖放为员工分配事件。 I would like to create overlapping Div as below image 2 我想创建重叠的Div,如下图2所示 在此处输入图片说明 This is onclick div created 这是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"});
    });

And that was my Dragging function. 那就是我的拖动功能。

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"));
        }
    });
}

No buddy Answer Me Thanks For that because i find it My self and learn it. 没有哥们回答我,谢谢,因为那是因为我找到了我自己并学习了它。 Any changes, suggestion Most welcome Respected Sir/ma'am 有任何更改,建议最受欢迎尊敬的先生/女士

$("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();
        });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM