Skip to content

Commit ee51109

Browse files
committed
mobile platform not gen scrollbar
1 parent 86d037c commit ee51109

File tree

2 files changed

+25
-24
lines changed

2 files changed

+25
-24
lines changed

cnblogs-article-nav.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ a.ready(function() {
3131
if (md.mobile()) {
3232

3333
//$('#mainContent').css('style','1');
34-
console.log("mobile platform");
34+
console.log("you platform is mobile");
3535
return;
3636
}else{
37-
console.log("not mobile platform");
37+
console.log("you platform not mobile ");
3838
}
3939

4040
//只有文章页面才会生成

cnblogs-customfunc.js

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,29 +73,30 @@ $(document).ready(function() {
7373
$('#mainContent').css('width',maxWidth);
7474
}*/
7575
});
76-
77-
$("<div id='toTop' title='回顶部'></div>").appendTo($("body"));
78-
$("#toTop").bind("click", function() {
79-
$("body,html").animate({
80-
scrollTop: '0px'
81-
}, 200);
82-
});
83-
$("<div id='toBottom' title='到底部'></div>").appendTo($("body"));
84-
$("#toBottom").bind("click", function() {
85-
//文章页下拉到评论区,其它页面拉到顶部
86-
if (document.getElementById("blog_post_info_block")) {
76+
var md = new MobileDetect(window.navigator.userAgent);
77+
if (md.mobile()){}else {
78+
$("<div id='toTop' title='回顶部'></div>").appendTo($("body"));
79+
$("#toTop").bind("click", function() {
8780
$("body,html").animate({
88-
scrollTop: $('#blog_post_info_block').offset().top
89-
}, 150);
90-
console.log("page is article");
91-
} else {
92-
$("body,html").animate({
93-
scrollTop: $('#footer').offset().top
94-
}, 150);
95-
console.log("page not article");
96-
}
97-
});
98-
81+
scrollTop: '0px'
82+
}, 200);
83+
});
84+
$("<div id='toBottom' title='到底部'></div>").appendTo($("body"));
85+
$("#toBottom").bind("click", function() {
86+
//文章页下拉到评论区,其它页面拉到顶部
87+
if (document.getElementById("blog_post_info_block")) {
88+
$("body,html").animate({
89+
scrollTop: $('#blog_post_info_block').offset().top
90+
}, 150);
91+
console.log("page is article");
92+
} else {
93+
$("body,html").animate({
94+
scrollTop: $('#footer').offset().top
95+
}, 150);
96+
console.log("page not article");
97+
}
98+
});
99+
}
99100
//版权信息
100101
var signatureHtml ="";
101102
signatureHtml += '作者:赵青青 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 出处:<a href="http://www.cnblogs.com/zhaoqingqing/">http://www.cnblogs.com/zhaoqingqing/</a><br />';

0 commit comments

Comments
 (0)