javascript - How to imitate Trello board click & drag to scroll -


i'm looking javascript plugin allow me add same functionality trello has on boards, can click on background, , drag either side scroll, in similar way on mobile finger.

i have found javascript works, need able click , drag child elements, without whole board scrolling. in other words, in trello when you're moving card between lists, background doesn't scroll, there needs ability add exception children elements.

any ideas? thanks.

so in process of creating jsfiddle give example of issue having. made it, decided try , fix it, , turns out wasn't hard.

i've kept fiddle , saved it, can see implementation. it's simple.

var curypos = 0,    curxpos = 0,    curdown = false;    $('.wall')[0].addeventlistener('mousemove', function(e) {      if (curdown === true) {      window.scrollto(document.body.scrollleft + (curxpos - e.pagex), document.body.scrolltop + (curypos - e.pagey));    }  });    $('.wall')[0].addeventlistener('mousedown', function(e) {    var $target = $(e.target);    if (!$target.hasclass('card')) {      curdown = true;      curypos = e.pagey;      curxpos = e.pagex;    }  });  $('.wall')[0].addeventlistener('mouseup', function(e) {    curdown = false;  });    $(function() {    (var = 1; <= 8; i++) {      $("#list" + i).sortable({        connectwith: "#list1, #list2, #list3, #list4, #list5, #list6, #list7, #list8"      }).disableselection();    }  });
* {    box-sizing: border-box;  }  html,  body {    height: 100%;  }  .wall {    width: 1280px;    height: 100%;    background-color: #0074d9;    font-size: 0;    word-spacing: 10px;    cursor: -webkit-grab;  }  .wall:active {    cursor: -webkit-grabbing;  }  .list {    display: inline-block;    width: 150px;    background-color: #ff4136;    font-size: initial;    height: 100%;    padding: 0 5px;    margin: 0;    list-style: none;  }  .card {    height: 50px;    width: 100%;    background-color: #2ecc40;    margin-top: 5px;  }
<div class="wall">    <ul class="list" id="list1">      <li class="card"></li>      <li class="card"></li>      <li class="card"></li>      <li class="card"></li>    </ul>    <ul class="list" id="list2">      <li class="card"></li>      <li class="card"></li>      <li class="card"></li>      <li class="card"></li>    </ul>    <ul class="list" id="list3">      <li class="card"></li>      <li class="card"></li>      <li class="card"></li>      <li class="card"></li>    </ul>    <ul class="list" id="list4">      <li class="card"></li>      <li class="card"></li>      <li class="card"></li>      <li class="card"></li>    </ul>    <ul class="list" id="list5">      <!-- empty list -->    </ul>    <ul class="list" id="list6">      <!-- empty list -->    </ul>    <ul class="list" id="list7">      <!-- empty list -->    </ul>    <ul class="list" id="list8">      <!-- empty list -->    </ul>  </div>

https://jsfiddle.net/ro2mtm98/3/

the reason wanting update assembla card wall add ability click , drag scroll horizontally. have own list dragging javascript (not sure plugin uses, pretty sure it's not jquery sortable. anyway, using script able figure out how make work on assembla too


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -