Make scrolling into the bufferlines div, not the whole window

This should improve scrolling experience, especially on webkit.
It also is needed for when nicklist will appear
This commit is contained in:
Tor Hveem 2013-10-25 22:19:23 +02:00
parent 5fb4ea2758
commit c9f7e9a732
3 changed files with 11 additions and 10 deletions

View file

@ -174,16 +174,16 @@ input[type=text], input[type=password], .badge {
min-height: 100%; min-height: 100%;
} }
.bufferlines { #bufferlines {
font-family: 'Terminus', 'Inconsolata', 'Consolas', 'Monaco', 'Ubuntu Mono', monospace; font-family: 'Terminus', 'Inconsolata', 'Consolas', 'Monaco', 'Ubuntu Mono', monospace;
position: relative;
height: 99%;
overflow-y: auto; overflow-y: auto;
margin-left: 14%; margin-left: 14%;
width: auto; width: auto;
position: relative; top: 25px; /* topbar */
padding-bottom: 60px; /* bottom input */
padding-top: 35px; /* topbar */
} }
.bufferlines .btn { #bufferlines .btn {
font-family: sans-serif; font-family: sans-serif;
} }
@ -191,7 +191,7 @@ input[type=text], input[type=password], .badge {
margin: 0 5px 0 14%; margin: 0 5px 0 14%;
} }
@media (max-width: 968px) { @media (max-width: 968px) {
#sidebar, .bufferlines { #sidebar, #bufferlines {
position: relative; position: relative;
min-height: 0; min-height: 0;
margin-left: 0; margin-left: 0;

View file

@ -211,7 +211,7 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="bufferlines"> <div id="bufferlines">
<table> <table>
<tbody> <tbody>
<tr class="bufferline" ng-repeat-start="bufferline in activeBuffer().lines"> <tr class="bufferline" ng-repeat-start="bufferline in activeBuffer().lines">

View file

@ -427,10 +427,11 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
if(readmarker) { if(readmarker) {
readmarker.scrollIntoView(); readmarker.scrollIntoView();
}else{ }else{
var sTop = document.documentElement.scrollTop; var bl = document.getElementById('bufferlines');
var sVal = document.documentElement.scrollHeight - document.documentElement.clientHeight; var sTop = bl.scrollTop;
var sVal = bl.scrollHeight - bl.clientHeight;
if(sTop < sVal) { if(sTop < sVal) {
document.documentElement.scrollTop = sVal; bl.scrollTop = sVal;
} }
} }
} }