[ticket/243] Move js files to assets folder and add getscrollbarwidth
B3P-243
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
/*! Copyright (c) 2008 Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
|
||||||
|
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||||
|
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the width of the OS scrollbar
|
||||||
|
*/
|
||||||
|
(function($) {
|
||||||
|
var scrollbarWidth = 0;
|
||||||
|
$.getScrollbarWidth = function() {
|
||||||
|
if ( !scrollbarWidth ) {
|
||||||
|
if ( $.browser.msie ) {
|
||||||
|
var $textarea1 = $('<textarea cols="10" rows="2"></textarea>')
|
||||||
|
.css({ position: 'absolute', top: -1000, left: -1000 }).appendTo('body'),
|
||||||
|
$textarea2 = $('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>')
|
||||||
|
.css({ position: 'absolute', top: -1000, left: -1000 }).appendTo('body');
|
||||||
|
scrollbarWidth = $textarea1.width() - $textarea2.width();
|
||||||
|
$textarea1.add($textarea2).remove();
|
||||||
|
} else {
|
||||||
|
var $div = $('<div />')
|
||||||
|
.css({ width: 100, height: 100, overflow: 'auto', position: 'absolute', top: -1000, left: -1000 })
|
||||||
|
.prependTo('body').append('<div />').find('div')
|
||||||
|
.css({ width: '100%', height: 200 });
|
||||||
|
scrollbarWidth = 100 - $div.width();
|
||||||
|
$div.parent().remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return scrollbarWidth;
|
||||||
|
};
|
||||||
|
})(jQuery);
|
||||||
@@ -19,17 +19,22 @@ var portal_right_width;
|
|||||||
*/
|
*/
|
||||||
phpbb.b3p_fix_right_column_margin = function() {
|
phpbb.b3p_fix_right_column_margin = function() {
|
||||||
var width = $(window).width();
|
var width = $(window).width();
|
||||||
|
var $portal_right = $('#portal-right');
|
||||||
|
var $portal_left = $('#portal-left');
|
||||||
|
var $portal_center = $('#portal-center');
|
||||||
|
|
||||||
if (width <= 880) {
|
if (width <= 895) {
|
||||||
// Get height of left and center column
|
// Get height of left and center column
|
||||||
var center_height = $('#portal-center').outerHeight();
|
var right_height = $portal_right.height();
|
||||||
var left_height = $('#portal-left').outerHeight();
|
var left_height = $portal_left.height();
|
||||||
|
// Get correct margin-left for portal-right and add 10px for padding
|
||||||
$('#portal-right').css('margin-top', -(center_height - left_height) + 'px');
|
$portal_right.css('margin-left', - ($portal_right.width() + 1));
|
||||||
$('#portal-right').width($('#portal-left').width());
|
$portal_center.css('margin-top', Math.max(left_height, right_height) + 'px');
|
||||||
} else {
|
} else {
|
||||||
$('#portal-right').css('margin-top', '0px');
|
$portal_right.css('margin-top', '0px');
|
||||||
$('#portal-right').width(portal_right_width);
|
$portal_right.css('margin-left', -$portal_left.width());
|
||||||
|
$portal_right.width($portal_left.width());
|
||||||
|
$portal_center.css('margin-top', 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Reference in New Issue
Block a user