Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Twitter bootstrap jQueryUI可排序、引导手风琴、.面板标题_Twitter Bootstrap_Jquery Ui_Jquery Ui Sortable - Fatal编程技术网

Twitter bootstrap jQueryUI可排序、引导手风琴、.面板标题

Twitter bootstrap jQueryUI可排序、引导手风琴、.面板标题,twitter-bootstrap,jquery-ui,jquery-ui-sortable,Twitter Bootstrap,Jquery Ui,Jquery Ui Sortable,如何将可排序元素移动到关闭的面板(放置在.panel heading)上 例如: 好的,我现在有时间先看一下 我希望这就是你想要的。至少从你的描述来看,我认为应该是这样的 JSFiddle: 我从stackoverflow的另一个答案中添加了一些javascript来检测元素是否悬停在标题上。如果元素悬停在一个封闭列表的标题上,那么我们将打开该列表,这样您就可以将元素放到该列表中。如果您对代码有疑问。请不要犹豫 HTML <div class="panel-group" id="acc

如何将可排序元素移动到关闭的面板(放置在
.panel heading
)上

例如:


好的,我现在有时间先看一下

我希望这就是你想要的。至少从你的描述来看,我认为应该是这样的

JSFiddle:

我从stackoverflow的另一个答案中添加了一些javascript来检测元素是否悬停在标题上。如果元素悬停在一个封闭列表的标题上,那么我们将打开该列表,这样您就可以将元素放到该列表中。如果您对代码有疑问。请不要犹豫

HTML

  <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
  <div class="panel-heading" role="tab" id="headingOne">
    <h4 class="panel-title collapse-link">
      <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
        Collapsible Group Item #1
      </a>
    </h4>
  </div>
  <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
    <div class="panel-body">
      <table class="table table-hover border-bottom table-tags">
        <thead>
          <tr>
            <th>Tag</th>
            <th class="text-right">Przypisani agenci</th>
            <th class="text-right">Usuń tag</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td><span class="label label-info label-big">panel 1 - tag 1</span></td>
            <td class="text-right">25</td>
            <td class="text-right"><a href="#" class="tag-remove"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a></td>
          </tr>
          <tr>
            <td><span class="label label-info label-big">panel 1 - tag 2</span></td>
            <td class="text-right">19</td>
            <td class="text-right"><a href="#" class="tag-remove"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a></td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>
<div class="panel panel-default">
  <div class="panel-heading" role="tab" id="headingTwo">
    <h4 class="panel-title collapse-link">
      <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
        Collapsible Group Item #2
      </a>
    </h4>
  </div>
  <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
    <div class="panel-body">
      <table class="table table-hover border-bottom table-tags">
        <thead>
          <tr>
            <th>Tag</th>
            <th class="text-right">Przypisani agenci</th>
            <th class="text-right">Usuń tag</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td><span class="label label-info label-big">panel 2 - tag 1</span></td>
            <td class="text-right">25</td>
            <td class="text-right"><a href="#" class="tag-remove"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a></td>
          </tr>
          <tr>
            <td><span class="label label-info label-big">panel 2 - tag 2</span></td>
            <td class="text-right">19</td>
            <td class="text-right"><a href="#" class="tag-remove"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a></td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>
<div class="panel panel-default">
  <div class="panel-heading" role="tab" id="headingThree">
    <h4 class="panel-title collapse-link">
      <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
        Collapsible Group Item #3
      </a>
    </h4>
  </div>
  <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
    <div class="panel-body">
      <table class="table table-hover border-bottom table-tags">
        <thead>
          <tr>
            <th>Tag</th>
            <th class="text-right">Przypisani agenci</th>
            <th class="text-right">Usuń tag</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td><span class="label label-info label-big">panel 3 - tag 1</span></td>
            <td class="text-right">25</td>
            <td class="text-right"><a href="#" class="tag-remove"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a></td>
          </tr>
          <tr>
            <td><span class="label label-info label-big">panel 3 - tag 2</span></td>
            <td class="text-right">19</td>
            <td class="text-right"><a href="#" class="tag-remove"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a></td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>

标签
普济皮萨尼机构
乌苏塔格
面板1-标签1
25
面板1-标签2
19
标签
普济皮萨尼机构
乌苏塔格
面板2-标签1
25
面板2-标签2
19
标签
普济皮萨尼机构
乌苏塔格
面板3-标签1
25
面板3-标签2
19

标签 普济皮萨尼机构 乌苏塔格 外部-标签1 25 外部-标签2 19 JAVASCRIPT

var $links = $('.collapse-link a');

// remove tag
$('body').on('click', '.tag-remove', function (event) {
  event.preventDefault();
  $(this).parents('tr').remove();
})

// drag/drop tags
$(".table-tags tbody").sortable({
    appendTo: document.body,
  connectWith: ".table-tags tbody",
  items: "> tr",
  start: function(event, ui) {
    var draggedItem = ui.helper;
    $(window).mousemove(function(e){
      moved(e, draggedItem);
    });
  },
  stop: function(event, ui) {
    $(window).unbind("mousemove");
  },
  helper: "clone"
}).disableSelection();

//Code from http://stackoverflow.com/questions/3298712/jquery-ui-sortable-determine-which-element-is-beneath-the-element-being-dragge
function moved(e, draggedItem) {
  //Dragged item's position++
  var dpos = draggedItem.position();
  var d = {
    top: dpos.top,
    bottom:    dpos.top + draggedItem.height(),
    left: dpos.left,
    right: dpos.left + draggedItem.width()
  };

  //Find sortable elements (li's) covered by draggedItem
  var hoveredOver = $links.not(draggedItem).filter(function() {
    var t = $(this);
    var pos = t.position();

    //This li's position++
    var p = {
      top: pos.top,
      bottom:    pos.top + t.height(),
      left: pos.left,
      right: pos.left + t.width()
    };

    //itc = intersect
    var itcTop         = p.top <= d.bottom;
    var itcBtm         = d.top <= p.bottom;
    var itcLeft     = p.left <= d.right;
    var itcRight     = d.left <= p.right;

    return itcTop && itcBtm && itcLeft && itcRight;
  });

    if(hoveredOver && hoveredOver.hasClass('collapsed')){
    hoveredOver.click();
  }
};
var$links=$('.collapse-linka');
//删除标签
$('body')。在('click','tag remove',函数(事件){
event.preventDefault();
$(this.parents('tr').remove();
})
//拖放标签
$(“.table标记tbody”).sortable({
附录:document.body,
连接方式:“.table标记tbody”,
项目:“>tr”,
开始:功能(事件、用户界面){
var draggedItem=ui.helper;
$(窗口).mousemove(函数(e){
移动(e,draggedItem);
});
},
停止:功能(事件、用户界面){
$(窗口)。解除绑定(“鼠标移动”);
},
助手:“克隆”
}).disableSelection();
//代码来自http://stackoverflow.com/questions/3298712/jquery-ui-sortable-determine-which-element-is-beneath-the-element-being-dragge
已移动函数(e,draggedItem){
//拖动项目的位置++
var dpos=draggedItem.position();
变量d={
top:dpos.top,
底部:dpos.top+draggedItem.height(),
左:dpos.left,
右:dpos.left+draggedItem.width()
};
//查找draggedItem覆盖的可排序元素(li)
var hoveredOver=$links.not(draggedItem).filter(函数(){
var t=$(本);
var pos=t.位置();
//这是李的立场++
var p={
顶部:位置顶部,
底部:位置顶部+t.高度(),
左:位置左,
右:位置左+t.宽度()
};
//itc=intersect

var itcTop=p.top您能再详细说明一下您的问题吗?我不能百分之百确定您想要获得的是什么?您希望面板在悬停时打开,然后可以将其放下。还是希望将其放到已关闭列表的顶部(然后将其添加到列表中)?我想把它放在关闭列表的顶部。
var $links = $('.collapse-link a');

// remove tag
$('body').on('click', '.tag-remove', function (event) {
  event.preventDefault();
  $(this).parents('tr').remove();
})

// drag/drop tags
$(".table-tags tbody").sortable({
    appendTo: document.body,
  connectWith: ".table-tags tbody",
  items: "> tr",
  start: function(event, ui) {
    var draggedItem = ui.helper;
    $(window).mousemove(function(e){
      moved(e, draggedItem);
    });
  },
  stop: function(event, ui) {
    $(window).unbind("mousemove");
  },
  helper: "clone"
}).disableSelection();

//Code from http://stackoverflow.com/questions/3298712/jquery-ui-sortable-determine-which-element-is-beneath-the-element-being-dragge
function moved(e, draggedItem) {
  //Dragged item's position++
  var dpos = draggedItem.position();
  var d = {
    top: dpos.top,
    bottom:    dpos.top + draggedItem.height(),
    left: dpos.left,
    right: dpos.left + draggedItem.width()
  };

  //Find sortable elements (li's) covered by draggedItem
  var hoveredOver = $links.not(draggedItem).filter(function() {
    var t = $(this);
    var pos = t.position();

    //This li's position++
    var p = {
      top: pos.top,
      bottom:    pos.top + t.height(),
      left: pos.left,
      right: pos.left + t.width()
    };

    //itc = intersect
    var itcTop         = p.top <= d.bottom;
    var itcBtm         = d.top <= p.bottom;
    var itcLeft     = p.left <= d.right;
    var itcRight     = d.left <= p.right;

    return itcTop && itcBtm && itcLeft && itcRight;
  });

    if(hoveredOver && hoveredOver.hasClass('collapsed')){
    hoveredOver.click();
  }
};