首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将JQuery可拖动可排序与div一起使用

将JQuery可拖动可排序与div一起使用
EN

Stack Overflow用户
提问于 2013-11-11 23:53:47
回答 1查看 2.5K关注 0票数 0

我正在尝试创建一个网格,其中填充了可拖动和可排序的“小部件”,理想情况下是用某种占位符点边框表示它们要去的地方。

目前,我的HTML标记如下所示:

代码语言:javascript
复制
<div id="widget-1" class="box grid_8">
    <div class="box-header">
        <i class="fa fa-dropbox fa-fw"></i> <p>New Orders</p>

    </div>
    <div class="box-content">
        <h1>926</h1>
        <h2>New <strong>Orders</strong></h2>
        <p class="grey-text">Need Your Attention</p>
        <a href="#" class="button">Take Me There</a>
    </div>
    <div class="box-footer">
        <a href=""> <i class="fa fa-cog fa-fw"></i> </a>

    </div>
</div>

每个框被分成页眉、内容和页脚--都是等高的。

我正在尝试获取它,这样我就可以使用标题作为句柄,并移动整个框,理想情况下也会显示其新位置的占位符。

下面是框的CSS:

代码语言:javascript
复制
/* ==========================================================================
   Boxes
   ========================================================================== */

.box {
    margin-top:10px;
    border: 1px solid #E0E0CF;
    background-color:#fff;
    height:250px;
    width:386px;
}

.box-2{
    margin-top:10px;
    border: 1px solid #E0E0CF;
    background-color:#fff;
    height:30px;

}

.box-static{

    margin-top:10px;
    border: 1px solid #E0E0CF;
    background-color:#fff;
    height:100%;


}


.box-header{
    border-bottom:1px solid #E0E0CF;
    height:30px;

}

.box-header i{
    float:left;
    margin:6px;
    color:grey;
}

.box-header p{
    float:right;
    margin:10px;
    font-size:8px;
    color:grey;
}

.box-header-static{
    border-bottom:1px solid #E0E0CF;
    height:60px;
}

.box-header-static i{
    float:left;
    margin:6px;
    color:grey;
}

.box-header-static h4{
    float:left;
    margin:15px 0px 0px 0px;
    line-height: 30px;
}


.box-header-static p{
    float:right;
    margin:10px;
    font-size:8px;
    color:grey;
}



.box-content{
    width:100%;
    height:190px;
    overflow:hidden;
    text-align:center;

}
.box-content-static{
    width:100%;
    height:100%;
    overflow:hidden;
    text-align:center;

}

.box-image{
    width:100%;
    height:100%;

}

.box-content p{
    position:relative;
    margin:11px 12px 13px 10px;

}

.box-footer{
    height:30px;
    border-top:1px solid #E0E0CF;
}
.box-footer i{
    height: 15px;
    float: right;
    border-left: 1px solid rgb(224, 224, 207);
    padding: 7px;
    position: relative;
    color: grey;
}

#widget-1 {


}
#widget-2 h3{
    margin:10px;
    position:relative;

}
#widget-2 span{

}
#widget-2 button{



}
#widget-3{


}
#widget-4{


}
.top-left-heading p{
    position: relative;
    margin:10px;

}
.top-left-heading p{
    position: absolute;
    top: 150px;
    left: 434px;
}

Js:

代码语言:javascript
复制
$(function() {
    $("#widget-1").sortable({containment: "parent"});
    $("#widget-1").disableSelection();
});
EN

回答 1

Stack Overflow用户

发布于 2013-11-12 00:12:52

这应该会对您有所帮助:http://jsfiddle.net/HgCjZ/1/

主要变化是增加了:

代码语言:javascript
复制
.ui-state-highlight {
    background:#eee;
    border:1px dotted #333;
    height:250px;
    width:386px;
    margin:10px 0;
}

placeholder: "ui-state-highlight"
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19910521

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档