1/** 2 * 页é¢readyæ¹æ³ 3 */ 4$(document).ready(function() { 5 6 categoryDisplay(); 7 generateContent(); 8 backToTop(); 9}); 10 11/** 12 * loadæ¹æ³ï¼é¡µé¢çå è½½å®æå触å 13 * {fixFooterInit();} åºå®Footeræ 14 */ 15/*$(window).load(function() { 16 fixFooterInit(); 17});*/ 18 19 20/** 21 * åºå®åºæ çåå§åæ¹æ³ 22 * å¨ä¸å¼å§è½½å ¥é¡µé¢æ¶ï¼ä½¿ç¨fixFooter()æ¹æ³åºå®åºæ ã 23 * 卿µè§å¨çªå£æ¹å大尿¯ï¼ä¾ç¶åºå®åºæ 24 * @return {[type]} [description] 25 */ 26function fixFooterInit() { 27 var footerHeight = $('footer').outerHeight(); 28 var footerMarginTop = getFooterMarginTop() - 0; //ç±»åè½¬æ¢ 29 // var footerMarginTop = 80; 30 31 fixFooter(footerHeight, footerMarginTop); //fix footer at the beginning 32 33 $(window).resize(function() { //when resize window, footer can auto get the postion 34 fixFooter(footerHeight, footerMarginTop); 35 }); 36 37 /* $('body').click(function() { 38 fixFooter(footerHeight, footerMarginTop); 39 });*/ 40 41 42} 43 44/** 45 * åºå®åºæ 46 * @param {number} footerHeight åºæ é«åº¦ 47 * @param {number} footerMarginTop åºæ MarginTop 48 * @return {[type]} [description] 49 */ 50function fixFooter(footerHeight, footerMarginTop) { 51 var windowHeight = $(window).height(); 52 var contentHeight = $('body>.container').outerHeight() + $('body>.container').offset().top + footerHeight + footerMarginTop; 53 // console.log("window---"+windowHeight); 54 // console.log("$('body>.container').outerHeight()---"+$('body>.container').outerHeight() ); 55 // console.log("$('body>.container').height()---"+$('body>.container').height() ); 56 // console.log("$('#main').height()--------"+$('#main').height()); 57 // console.log("$('body').height()--------"+$('body').height()); 58 //console.log("$('#main').html()--------"+$('#main').html()); 59 // console.log("$('body>.container').offset().top----"+$('body>.container').offset().top); 60 // console.log("footerHeight---"+footerHeight); 61 // console.log("footerMarginTop---"+footerMarginTop); 62 console.log(contentHeight); 63 if (contentHeight < windowHeight) { 64 $('footer').addClass('navbar-fixed-bottom'); 65 } else { 66 $('footer').removeClass('navbar-fixed-bottom'); 67 } 68 69 $('footer').show(400); 70} 71 72/** 73 * ä½¿ç¨æ£å表达å¼å¾å°åºæ çMarginTop 74 * @return {string} åºæ çMarginTop 75 */ 76function getFooterMarginTop() { 77 var margintop = $('footer').css('marginTop'); 78 var patt = new RegExp("[0-9]*"); 79 var re = patt.exec(margintop); 80 // console.log(re[0]); 81 return re[0]; 82} 83 84/** 85 * åç±»å±ç¤º 86 * ç¹å»å³ä¾§çåç±»å±ç¤ºæ¶ 87 * 左侧çç¸å ³è£åå±å¼æè æ¶èµ· 88 * @return {[type]} [description] 89 */ 90function categoryDisplay() { 91 /*only show All*/ 92 $('.post-list-body>div[post-cate!=All]').hide(); 93 /*show category when click categories list*/ 94 $('.categories-list-item').click(function() { 95 var cate = $(this).attr('cate'); //get category's name 96 97 $('.post-list-body>div[post-cate!=' + cate + ']').hide(250); 98 $('.post-list-body>div[post-cate=' + cate + ']').show(400); 99 }); 100} 101 102/** 103 * åå°é¡¶é¨ 104 */ 105function backToTop() { 106 //æ»é¡µé¢ææ¾ç¤ºè¿åé¡¶é¨ 107 $(window).scroll(function() { 108 if ($(window).scrollTop() > 100) { 109 $("#top").fadeIn(500); 110 } else { 111 $("#top").fadeOut(500); 112 } 113 }); 114 //ç¹å»åå°é¡¶é¨ 115 $("#top").click(function() { 116 $("body").animate({ 117 scrollTop: "0" 118 }, 500); 119 }); 120 121 //åå§åtip 122 $(function() { 123 $('[data-toggle="tooltip"]').tooltip(); 124 }); 125} 126 127 128/** 129 * ä¾§è¾¹ç®å½ 130 */ 131function generateContent() { 132 133 // console.log($('#markdown-toc').html()); 134 if (typeof $('#markdown-toc').html() === 'undefined') { 135 // $('#content .content-text').html('<ul><li>ææ¬è¾çï¼ææ ç®å½</li></ul>'); 136 $('#content').hide(); 137 $('#myArticle').removeClass('col-sm-9').addClass('col-sm-12'); 138 } else { 139 $('#content .content-text').html('<ul>' + $('#markdown-toc').html() + '</ul>'); 140 /* //æ°æ®å è½½å®æåï¼å åºå®è¾¹æ 141 $('#myAffix').attr({ 142 'data-spy': 'affix', 143 'data-offset': '50' 144 });*/ 145 } 146 console.log("myAffix!!!"); 147}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.