JQuery Draggable and Resizeable over IFrames (Solution)

前端 未结 6 1190
野性不改
野性不改 2021-02-07 02:55

I recently ran into some troubles using JQuery Draggable and Resizable plugins. Looking for solutions, i found some very fragmented code in many different places and finally fil

6条回答
  •  北恋
    北恋 (楼主)
    2021-02-07 03:26

    Why so hard? There is much more beautiful solution:

    • put your iframe inside relative div with some z-index, say 0
    • make iframe relative also and change it's z-index to -1 during dragging:

    code:

    $("#Div").draggable({
        start: function () {
            $("iframe").css('z-index', '-1');
        },
        stop: function () {
            $("iframe").css('z-index', '0');
        }
    });
    

提交回复
热议问题