Add adjustments for browsers with fixed scrollbar

(imported from commit 462a3eb5e6b83f9d8091b83e3f8dc458236938ed)
This commit is contained in:
Allen Rabinovich 2014-02-11 09:40:49 -07:00 committed by Jason Michalski
parent c63f881518
commit addfcbfc30
3 changed files with 38 additions and 5 deletions

View File

@ -352,6 +352,16 @@ function set_user_list_heights(res, usable_height, user_presences, group_pms) {
res.group_pms_max_height = blocks[1].max_height;
}
function scrollbarWidth() {
$('body').prepend('<div id="outertest" style="width:200px; height:150px; position: absolute; top: 0; left: 0; overflow-x:hidden; overflow-y:scroll; background: #ff0000; visibility: hidden;"><div id="innertest" style="width:100%; height: 200px; overflow-y: visible;">&nbsp;</div></div>');
var scrollwidth = $("#outertest").outerWidth() - $("#innertest").outerWidth();
$("#outertest").remove();
return scrollwidth;
}
function get_new_heights() {
var res = {};
var viewport_height = viewport.height();
@ -1891,6 +1901,32 @@ $(function () {
}
});
// Workaround for browsers with fixed scrollbars
$(function () {
var sbWidth = scrollbarWidth(),
halfSbWidth = Math.floor(sbWidth/2);
if (sbWidth > 0) {
var frbMargin = parseInt($(".recipient-bar-main").css("margin-right"));
$(".header").css("left", "-" + sbWidth + "px");
$(".header-main").css("left", sbWidth + "px");
$("#compose").css("left", "-" + sbWidth + "px");
$(".compose-content").css("left", halfSbWidth + "px");
var rbcMaxWidth = parseInt($(".recipient-bar-content").css("max-width"));
$(".recipient-bar-content").css("max-width", (1210 + sbWidth) + "px");
var rbcMarginRight = parseInt($(".recipient-bar-main").css("margin-right"));
$(".recipient-bar-main").css("margin-right", (210 + sbWidth) + "px");
$("#user-list, #group-pm-list").css("margin-right", sbWidth + "px");
$("head").append("<style type='text/css'>.left-sidebar #user-list, .left-sidebar #group-pm-list { margin-right: 0px !important; } @media (max-width: 975px) { .recipient-bar-main { margin-right: " + (20 + sbWidth) + "px !important; } } @media (max-width: 775px) { .recipient-bar-main { margin-right: " + (25 + sbWidth) + "px !important; } }</style>");
$("#tab_list").css("padding-right", "15px");
}
});
return exports;
}());

View File

@ -390,10 +390,7 @@ a:hover code {
#user_presences, #group-pms {
list-style-position: inside; /* Draw the bullets inside our box */
margin-left: 0;
overflow-y: hidden;
}
#user_presences:hover, #group-pms:hover {
overflow-y: auto;
overflow-y: auto;
}
#user_presences li:hover, #group-pms li:hover {

View File

@ -58,7 +58,7 @@ var page_params = {{ page_params }};
{% include "zerver/navbar.html" %}
<div class="app">
<div class="app" id="mainapp">
<div class="app-main">
<div class="column-left">
{% include "zerver/left-sidebar.html" %}