增加功能:移除niceScroll使用mCustomScrollbar
This commit is contained in:
parent
0178738d07
commit
9c90eda702
|
@ -6,9 +6,11 @@
|
||||||
<link href="~/css/sweetalert.css" rel="stylesheet" asp-append-version="true" />
|
<link href="~/css/sweetalert.css" rel="stylesheet" asp-append-version="true" />
|
||||||
<environment include="Development">
|
<environment include="Development">
|
||||||
<link href="~/css/toastr.css" rel="stylesheet" asp-append-version="true" />
|
<link href="~/css/toastr.css" rel="stylesheet" asp-append-version="true" />
|
||||||
|
<link href="~/css/jquery.mCustomScrollbar.css" rel="stylesheet" />
|
||||||
</environment>
|
</environment>
|
||||||
<environment exclude="Development">
|
<environment exclude="Development">
|
||||||
<link href="~/css/toastr.min.css" rel="stylesheet" asp-append-version="true" />
|
<link href="~/css/toastr.min.css" rel="stylesheet" asp-append-version="true" />
|
||||||
|
<link href="~/css/jquery.mCustomScrollbar.min.css" rel="stylesheet" />
|
||||||
</environment>
|
</environment>
|
||||||
@RenderSection("css", false)
|
@RenderSection("css", false)
|
||||||
<link href="~/css/admin.css" rel="stylesheet" asp-append-version="true" />
|
<link href="~/css/admin.css" rel="stylesheet" asp-append-version="true" />
|
||||||
|
@ -17,11 +19,11 @@
|
||||||
@section javascript {
|
@section javascript {
|
||||||
<environment include="Development">
|
<environment include="Development">
|
||||||
<script src="~/js/sweetalert.js" asp-append-version="true"></script>
|
<script src="~/js/sweetalert.js" asp-append-version="true"></script>
|
||||||
<script src="~/js/jquery.nicescroll.js" asp-append-version="true"></script>
|
<script src="~/js/jquery.mCustomScrollbar.js"></script>
|
||||||
</environment>
|
</environment>
|
||||||
<environment exclude="Development">
|
<environment exclude="Development">
|
||||||
<script src="~/js/sweetalert.min.js" asp-append-version="true"></script>
|
<script src="~/js/sweetalert.min.js" asp-append-version="true"></script>
|
||||||
<script src="~/js/jquery.nicescroll.min.js" asp-append-version="true"></script>
|
<script src="~/js/jquery.mCustomScrollbar.concat.min.js"></script>
|
||||||
</environment>
|
</environment>
|
||||||
<script src="~/js/jquery.dcjqaccordion.2.7.js" asp-append-version="true"></script>
|
<script src="~/js/jquery.dcjqaccordion.2.7.js" asp-append-version="true"></script>
|
||||||
<script src="~/js/common-scripts.js" asp-append-version="true"></script>
|
<script src="~/js/common-scripts.js" asp-append-version="true"></script>
|
||||||
|
|
|
@ -16,10 +16,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 769px) {
|
@media (min-width: 769px) {
|
||||||
body {
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-open .main-content {
|
.sidebar-open .main-content {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
display: block;
|
display: block;
|
||||||
|
|
|
@ -17,6 +17,10 @@
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mCSB_scrollTools {
|
||||||
|
width: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.main-content {
|
.main-content {
|
||||||
padding: 15px 15px 0 15px;
|
padding: 15px 15px 0 15px;
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fa-nav nav a {
|
.fa-nav nav a {
|
||||||
|
@ -70,6 +71,10 @@
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fa-nav .mCS-minimal-dark.mCSB_scrollTools_vertical {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.form-group .input-group .input-group-append .btn i {
|
.form-group .input-group .input-group-append .btn i {
|
||||||
color: #187c9a;
|
color: #187c9a;
|
||||||
width: 22px;
|
width: 22px;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -52,7 +52,7 @@
|
||||||
transition: none;
|
transition: none;
|
||||||
transform: translate(0);
|
transform: translate(0);
|
||||||
width: 210px;
|
width: 210px;
|
||||||
overflow: auto;
|
overflow: hidden;
|
||||||
bottom: 40px;
|
bottom: 40px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,42 +153,39 @@ $(function () {
|
||||||
|
|
||||||
$.fn.extend({
|
$.fn.extend({
|
||||||
autoScrollSidebar: function (options) {
|
autoScrollSidebar: function (options) {
|
||||||
var $this = this;
|
if (!this.hasClass('mCustomScrollbar')) return;
|
||||||
var option = $.extend({ target: null, offsetTop: 0 }, options);
|
var option = $.extend({ target: null, offsetTop: 0 }, options);
|
||||||
var navItem = option.target;
|
var $navItem = option.target;
|
||||||
var top = navItem.offset().top + $this.scrollTop() - $('header').outerHeight() + option.offsetTop;
|
if ($navItem === null) return;
|
||||||
|
|
||||||
// sidebar scroll animate
|
// sidebar scroll animate
|
||||||
var middle = $this.outerHeight() / 2;
|
var middle = this.outerHeight() / 2;
|
||||||
if (top > middle) $this.animate({ scrollTop: top - middle }, 500, function () {
|
var top = $navItem.offset().top - $('header').outerHeight() + option.offsetTop;
|
||||||
$this.resizeNiceScroll();
|
if (top > middle) this.mCustomScrollbar('scrollTo', top - middle);
|
||||||
});
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
resizeNiceScroll: function () {
|
|
||||||
if (!$.browser.versions.ios) this.getNiceScroll().resize();
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
addNiceScroll: function () {
|
addNiceScroll: function () {
|
||||||
if (!$.browser.versions.ios) {
|
if (!$.browser.versions.ios && $(window).width() > 768) {
|
||||||
var nice = this.data('__nicescroll') || false;
|
this.mCustomScrollbar({ theme: 'minimal' });
|
||||||
if (!nice) this.niceScroll({ cursorcolor: "#e8403f", cursorwidth: '3px', background: '#2a3542', spacebarenabled: false, cursorborder: '' });
|
}
|
||||||
|
else {
|
||||||
|
this.mCustomScrollbar('destroy');
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// custom scrollbar
|
// custom scrollbar
|
||||||
var $sidebar = $('aside').addNiceScroll();
|
var $sidebar = $('aside').addNiceScroll().autoScrollSidebar({ target: arch.parent(), offsetTop: arch.parent().innerHeight() / 2 });
|
||||||
$sidebar.autoScrollSidebar({ target: arch.parent(), offsetTop: arch.parent().innerHeight() / 2 });
|
|
||||||
|
|
||||||
$sideMenu.on('click', 'a.dcjq-parent', function () {
|
$sideMenu.on('click', 'a.dcjq-parent', function () {
|
||||||
|
if ($(window).width() <= 768) return;
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
if (!$this.hasClass('active')) {
|
setTimeout(function () {
|
||||||
setTimeout(function () { $sidebar.resizeNiceScroll(); }, 500);
|
var offsetScroll = parseInt($this.parents('.mCSB_container').css('top').replace('px', ''));
|
||||||
return;
|
$sidebar.autoScrollSidebar({ target: $this.parent(), offsetTop: 25.5 - offsetScroll });
|
||||||
}
|
}, 600);
|
||||||
$sidebar.autoScrollSidebar({ target: $(this).parent(), offsetTop: 25.5 });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.sidebar-toggle-box').on('click', function () {
|
$('.sidebar-toggle-box').on('click', function () {
|
||||||
|
@ -224,11 +221,6 @@ $(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window).on('resize', function () {
|
$(window).on('resize', function () {
|
||||||
if ($(window).width() > 768) {
|
|
||||||
$sidebar.addNiceScroll();
|
$sidebar.addNiceScroll();
|
||||||
}
|
|
||||||
else {
|
|
||||||
$sidebar.removeAttr('style').getNiceScroll().remove();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
$('#main-content').scrollspy({ offset: 150, target: '.fa-nav' });
|
$('#main-content').scrollspy({ offset: 150, target: '.fa-nav' });
|
||||||
|
|
||||||
if (!$.browser.versions.ios) $html.find('.fa-nav .nav').niceScroll({ cursorcolor: "#e8403f", cursorwidth: '3px', spacebarenabled: false, cursorborder: '' });
|
if (!$.browser.versions.ios) $html.find('.fa-nav .nav').mCustomScrollbar({ theme: 'minimal-dark' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
|
@ -252,7 +252,7 @@
|
||||||
$(this).scrollspy({ target: $(this).attr('data-target') });
|
$(this).scrollspy({ target: $(this).attr('data-target') });
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!$.browser.versions.ios) $scroll = $html.find('.fa-nav .nav').niceScroll({ cursorcolor: "#e8403f", cursorwidth: '3px', background: '#fff', spacebarenabled: false, cursorborder: '' });
|
if (!$.browser.versions.ios) $scroll = $html.find('.fa-nav .nav').mCustomScrollbar({ theme: 'minimal-dark' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue