I have prepared a jsFiddle for my question -
I am trying to have jQuery UI Selectable in a table with yellow header and footer rows. Once as a grid of numbers in the left cell and then as a list of letters in the right cell.
Also I am trying to have the table occupy both 100% of browser width and height.
That is why I have assigned CSS-properties width: 100% and height: 100vh to the table and overflow-y: scroll to the both selectables.
For some reason however the right scroll is not working, i.e. the whole list of letters is displayed and thus blows up the table height.
TLDR:
- Numbers/Letters lists should have same height and be scrollable
- Yellow header/footer should be visible at top/bottom of browser window
Here is my code -
Javascript:
$(function() {
$("#selectable1").selectable();
$("#selectable2").selectable();
});
CSS:
<table>
<tr>
<td colspan=2 bgcolor="yellow">Header1</td>
</tr>
<tr>
<td>
<ol id="selectable1">
<li class="ui-state-default">1</li>
<li class="ui-state-default">2</li>
<li class="ui-state-default">3</li>
<li class="ui-state-default">4</li>
<li class="ui-state-default">5</li>
<li class="ui-state-default">6</li>
<li class="ui-state-default">7</li>
<li class="ui-state-default">8</li>
<li class="ui-state-default">9</li>
<li class="ui-state-default">10</li>
<li class="ui-state-default">11</li>
<li class="ui-state-default">12</li>
</ol>
</td>
<td>
<ol id="selectable2">
<li class="ui-state-default">A</li>
<li class="ui-state-default">B</li>
<li class="ui-state-default">C</li>
<li class="ui-state-default">D</li>
<li class="ui-state-default">E</li>
<li class="ui-state-default">F</li>
<li class="ui-state-default">G</li>
<li class="ui-state-default">H</li>
<li class="ui-state-default">I</li>
<li class="ui-state-default">J</li>
</ol>
</td>
</tr>
<tr>
<td colspan=2 bgcolor="yellow">Footer1</td>
</tr>
</table>
CSS:
table {
width: 100%;
height: 100vh;
}
#selectable1 {
list-style-type: none;
margin: 0;
padding: 0;
overflow-y: scroll;
}
#selectable2 {
list-style-type: none;
margin: 0;
padding: 0;
width: 100px;
overflow-y: scroll; /* WHY IS THIS NOT WORKING? */
}
#selectable1 li,
#selectable2 li {
margin: 3px;
padding: 1px;
float: left;
width: 100px;
height: 80px;
font-size: 4em;
text-align: center;
}
The background for my question is that I am trying to create a card game with playing tables on the left and list of players in the lobby on the right -

