@@ -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 += '作者:赵青青 出处:<a href="http://www.cnblogs.com/zhaoqingqing/">http://www.cnblogs.com/zhaoqingqing/</a><br />' ;
0 commit comments