启用slimScroll美化滚动条

pull/71/head
PPPSCN 2018-04-10 07:05:50 +08:00
parent d84a277615
commit 180ce5c514
2 changed files with 17 additions and 4 deletions

View File

@ -1,4 +1,4 @@
define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefined, Toastr, Layer, Lang) { define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'slimscroll'], function ($, undefined, Toastr, Layer, Lang, slimScroll) {
var Fast = { var Fast = {
config: { config: {
//toastr默认配置 //toastr默认配置
@ -105,7 +105,7 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefine
} }
name = name.replace(/[\[\]]/g, "\\$&"); name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url); results = regex.exec(url);
if (!results) if (!results)
return null; return null;
if (!results[2]) if (!results[2])
@ -232,8 +232,8 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefine
}, },
lang: function () { lang: function () {
var args = arguments, var args = arguments,
string = args[0], string = args[0],
i = 1; i = 1;
string = string.toLowerCase(); string = string.toLowerCase();
//string = typeof Lang[string] != 'undefined' ? Lang[string] : string; //string = typeof Lang[string] != 'undefined' ? Lang[string] : string;
if (typeof Lang[string] != 'undefined') { if (typeof Lang[string] != 'undefined') {
@ -301,6 +301,16 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefine
}); });
//公共代码 //公共代码
$(function ($) {
if (self === top) {
$('#main').slimScroll({height: $(window).height() + 'px'});
} else {
var ScrollHeight = $('iframe', parent.document).height();
if (ScrollHeight) {
$('#main').slimScroll({height: ScrollHeight + 'px'});
}
}
});
//配置Toastr的参数 //配置Toastr的参数
Toastr.options = Fast.config.toastr; Toastr.options = Fast.config.toastr;
} }

View File

@ -120,6 +120,9 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
}); });
//当内容渲染完成后 //当内容渲染完成后
table.on('post-body.bs.table', function (e, settings, json, xhr) { table.on('post-body.bs.table', function (e, settings, json, xhr) {
var ScrollHeight = self == top ? $(window).height() : $('.content-wrapper', parent.document).height();
table.closest('#main').height(ScrollHeight);
table.closest('.slimScrollDiv').height(ScrollHeight);
$(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin"); $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
$(Table.config.disabledbtn, toolbar).toggleClass('disabled', true); $(Table.config.disabledbtn, toolbar).toggleClass('disabled', true);
if ($(Table.config.firsttd, table).find("input[type='checkbox'][data-index]").size() > 0) { if ($(Table.config.firsttd, table).find("input[type='checkbox'][data-index]").size() > 0) {