fix: pc侧边栏显示

This commit is contained in:
shenyu 2019-12-04 19:27:58 +08:00
parent 9d110203da
commit 7be50ad743
2 changed files with 15 additions and 10 deletions

View File

@ -59,7 +59,7 @@ $base-style
padding 1rem 1.5rem padding 1rem 1.5rem
tbody tbody
tr:nth-child(2n) tr:nth-child(2n)
background-color rgba(froth, .25) background-color transparent
blockquote blockquote
display block display block

View File

@ -127,26 +127,26 @@
// //
// lazyload // lazyload
$("img.lazy").lazyload({ $("img.lazy").lazyload({
effect : "fadeIn" effect: "fadeIn"
}); });
// //
// justifiedGallery // justifiedGallery
$('#gallery').justifiedGallery({ $('#gallery').justifiedGallery({
rowHeight : 200, rowHeight: 200,
margins : 5 margins: 5
}); });
// //
$(document).ready(function ($) { $(document).ready(function ($) {
$('.anchor').click(function (event) { $('.anchor').click(function (event) {
event.preventDefault(); event.preventDefault();
$('main').animate({scrollTop: $(this.hash).offset().top}, 'smooth'); $('main').animate({ scrollTop: $(this.hash).offset().top }, 'smooth');
}); });
}); });
// To top // To top
(function($) { (function ($) {
// When to show the scroll link // When to show the scroll link
// higher number = scroll link appears further down the page // higher number = scroll link appears further down the page
var upperLimit = 1000; var upperLimit = 1000;
@ -161,16 +161,16 @@
scrollElem.hide(); scrollElem.hide();
$('.content').scroll(function () { $('.content').scroll(function () {
var scrollTop = $('.content').scrollTop(); var scrollTop = $('.content').scrollTop();
if ( scrollTop > upperLimit ) { if (scrollTop > upperLimit) {
$(scrollElem).stop().fadeTo(300, 1); // fade back in $(scrollElem).stop().fadeTo(300, 1); // fade back in
}else{ } else {
$(scrollElem).stop().fadeTo(300, 0); // fade out $(scrollElem).stop().fadeTo(300, 0); // fade out
} }
}); });
// Scroll to top animation on click // Scroll to top animation on click
$(scrollElem).click(function(){ $(scrollElem).click(function () {
$('.content').animate({scrollTop:0}, scrollSpeed); return false; $('.content').animate({ scrollTop: 0 }, scrollSpeed); return false;
}); });
})(jQuery); })(jQuery);
@ -204,6 +204,11 @@
$sidebar.removeClass('on'); $sidebar.removeClass('on');
}); });
if (window.matchMedia("(min-width: 768px)").matches) {
$content.addClass('on');
$sidebar.addClass('on');
}
})(jQuery); })(jQuery);