创建博客

This commit is contained in:
lemonchann
2019-11-17 01:12:14 +08:00
commit 6f0c102626
133 changed files with 20640 additions and 0 deletions

39
static/js/category.js Normal file
View File

@@ -0,0 +1,39 @@
/**
* 页面ready方法
*/
$(document).ready(function() {
categoryDisplay();
});
/**
* 分类展示
* 点击右侧的分类展示时
* 左侧的相关裂变展开或者收起
* @return {[type]} [description]
*/
function categoryDisplay() {
selectCategory();
$('.categories-item').click(function() {
window.location.hash = "#" + $(this).attr("cate");
selectCategory();
});
}
function selectCategory(){
var exclude = ["",undefined];
var thisId = window.location.hash.substring(1);
var allow = true;
for(var i in exclude){
if(thisId == exclude[i]){
allow = false;
break;
}
}
if(allow){
var cate = thisId;
$("section[post-cate!='" + cate + "']").hide(200);
$("section[post-cate='" + cate + "']").show(200);
} else {
$("section[post-cate='All']").show();
}
}