增加功能:移除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" />
|
||||
<environment include="Development">
|
||||
<link href="~/css/toastr.css" rel="stylesheet" asp-append-version="true" />
|
||||
<link href="~/css/jquery.mCustomScrollbar.css" rel="stylesheet" />
|
||||
</environment>
|
||||
<environment exclude="Development">
|
||||
<link href="~/css/toastr.min.css" rel="stylesheet" asp-append-version="true" />
|
||||
<link href="~/css/jquery.mCustomScrollbar.min.css" rel="stylesheet" />
|
||||
</environment>
|
||||
@RenderSection("css", false)
|
||||
<link href="~/css/admin.css" rel="stylesheet" asp-append-version="true" />
|
||||
|
@ -17,11 +19,11 @@
|
|||
@section javascript {
|
||||
<environment include="Development">
|
||||
<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 exclude="Development">
|
||||
<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>
|
||||
<script src="~/js/jquery.dcjqaccordion.2.7.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) {
|
||||
body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sidebar-open .main-content {
|
||||
margin-left: 0;
|
||||
display: block;
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
display: none;
|
||||
}
|
||||
|
||||
.mCSB_scrollTools {
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
padding: 15px 15px 0 15px;
|
||||
margin-left: 0;
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
bottom: 0;
|
||||
position: absolute;
|
||||
overflow-y: auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.fa-nav nav a {
|
||||
|
@ -70,6 +71,10 @@
|
|||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.fa-nav .mCS-minimal-dark.mCSB_scrollTools_vertical {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.form-group .input-group .input-group-append .btn i {
|
||||
color: #187c9a;
|
||||
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;
|
||||
transform: translate(0);
|
||||
width: 210px;
|
||||
overflow: auto;
|
||||
overflow: hidden;
|
||||
bottom: 40px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,42 +153,39 @@ $(function () {
|
|||
|
||||
$.fn.extend({
|
||||
autoScrollSidebar: function (options) {
|
||||
var $this = this;
|
||||
if (!this.hasClass('mCustomScrollbar')) return;
|
||||
var option = $.extend({ target: null, offsetTop: 0 }, options);
|
||||
var navItem = option.target;
|
||||
var top = navItem.offset().top + $this.scrollTop() - $('header').outerHeight() + option.offsetTop;
|
||||
var $navItem = option.target;
|
||||
if ($navItem === null) return;
|
||||
|
||||
// sidebar scroll animate
|
||||
var middle = $this.outerHeight() / 2;
|
||||
if (top > middle) $this.animate({ scrollTop: top - middle }, 500, function () {
|
||||
$this.resizeNiceScroll();
|
||||
});
|
||||
return this;
|
||||
},
|
||||
resizeNiceScroll: function () {
|
||||
if (!$.browser.versions.ios) this.getNiceScroll().resize();
|
||||
var middle = this.outerHeight() / 2;
|
||||
var top = $navItem.offset().top - $('header').outerHeight() + option.offsetTop;
|
||||
if (top > middle) this.mCustomScrollbar('scrollTo', top - middle);
|
||||
|
||||
return this;
|
||||
},
|
||||
addNiceScroll: function () {
|
||||
if (!$.browser.versions.ios) {
|
||||
var nice = this.data('__nicescroll') || false;
|
||||
if (!nice) this.niceScroll({ cursorcolor: "#e8403f", cursorwidth: '3px', background: '#2a3542', spacebarenabled: false, cursorborder: '' });
|
||||
if (!$.browser.versions.ios && $(window).width() > 768) {
|
||||
this.mCustomScrollbar({ theme: 'minimal' });
|
||||
}
|
||||
else {
|
||||
this.mCustomScrollbar('destroy');
|
||||
}
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
// custom scrollbar
|
||||
var $sidebar = $('aside').addNiceScroll();
|
||||
$sidebar.autoScrollSidebar({ target: arch.parent(), offsetTop: arch.parent().innerHeight() / 2 });
|
||||
var $sidebar = $('aside').addNiceScroll().autoScrollSidebar({ target: arch.parent(), offsetTop: arch.parent().innerHeight() / 2 });
|
||||
|
||||
$sideMenu.on('click', 'a.dcjq-parent', function () {
|
||||
if ($(window).width() <= 768) return;
|
||||
var $this = $(this);
|
||||
if (!$this.hasClass('active')) {
|
||||
setTimeout(function () { $sidebar.resizeNiceScroll(); }, 500);
|
||||
return;
|
||||
}
|
||||
$sidebar.autoScrollSidebar({ target: $(this).parent(), offsetTop: 25.5 });
|
||||
setTimeout(function () {
|
||||
var offsetScroll = parseInt($this.parents('.mCSB_container').css('top').replace('px', ''));
|
||||
$sidebar.autoScrollSidebar({ target: $this.parent(), offsetTop: 25.5 - offsetScroll });
|
||||
}, 600);
|
||||
});
|
||||
|
||||
$('.sidebar-toggle-box').on('click', function () {
|
||||
|
@ -224,11 +221,6 @@ $(function () {
|
|||
});
|
||||
|
||||
$(window).on('resize', function () {
|
||||
if ($(window).width() > 768) {
|
||||
$sidebar.addNiceScroll();
|
||||
}
|
||||
else {
|
||||
$sidebar.removeAttr('style').getNiceScroll().remove();
|
||||
}
|
||||
});
|
||||
});
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
$('#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') });
|
||||
});
|
||||
|
||||
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