首页 > 解决方案 > 将元素从折叠的侧边栏拖到正文

问题描述

我正在尝试将元素从侧边栏面板拖动到页面正文,但它不会落在正文中。

当我初始化可拖动元素但没有成功时,我已经尝试了很多选项。

这就是我的可拖动对象的初始化方式:

$('.draggable-dash').draggable({
            revert: "invalid",
            helper: 'clone',
            appendTo: '.dropdashboard',
            containment: 'body',
            //zIndex: 2500,
            scroll: false,
            cursorAt: { top: -5, left: -5 },
            start: function(){
                $(this).hide();
            },
            stop: function(){
                $(this).show()
            }            
        });

这是面板 css

.theme-panel {
    position: fixed;
    right: -175px;
    top: 150px;
    z-index: 1020;
    background: #fff;
    padding: 15px;
    width: 175px;
    transition: right .2s linear;
    border-radius: 4px 0 0 4px;
}

.theme-panel.theme-panel-lg .theme-panel-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: scroll;
    margin: 0;
    padding: 20px;
}

这是正在发生的事情的图像。如您所见,元素在拖动模式下的位置也是错误的。

我不知道该怎么做才能解决它:(

标签: jquerydraggable

解决方案


推荐阅读