修改博客园的导航

 1 /*运行代码*/
 2 function runCode(id){
 3     var obj = document.getElementById(id); 
 4     var TestWin=open('');  
 5     TestWin.opener = null;
 6     TestWin.document.write(obj.value); 
 7     TestWin.document.close(); 
 8 }
 9 
10 /*加载脚本*/
11 function loader(name){
12     var elem=document.createElement('script');
13     elem.src='https://files.cnblogs.com/lhb25/'+name;
14     document.getElementsByTagName('head')[0].appendChild(elem);
15 }
16 
17 /*回到顶部*/
18 $(function(){
19     // hide #back-top first
20     $("#back-top").hide();
21     // fade in #back-top
22     $(window).scroll(function () {
23         if ($(this).scrollTop() > 500) {
24             $('#back-top').fadeIn();
25         } else {
26             $('#back-top').fadeOut();
27         }
28     });
29     // scroll body to 0px on click
30     $('#back-top a').click(function () {
31         $('body,html').animate({
32             scrollTop: 0
33         }, 800);
34         return false;
35     });
36 });
37 
38 /*自定义导航*/
39 $(function(){
40     $("#navList").append('<li><a class="menu" href="http://www.cnblogs.com/lhb25/category/279316.html">网页设计</a></li><li><a class="menu" href="http://www.cnblogs.com/lhb25/category/277769.html">精美素材</a></li><li><a class="menu" href="http://www.cnblogs.com/lhb25/category/146074.html">JavaScript</a></li><li><a class="menu" href="http://www.cnblogs.com/lhb25/category/277997.html">jQuery</a></li><li><a class="menu" href="http://www.cnblogs.com/lhb25/category/146076.html">HTML5</a></li><li><a class="menu" href="http://www.cnblogs.com/lhb25/category/146075.html">CSS3</a></li>');
41     $("#MyLinks1_XMLLink").parent().appendTo($("#navList"));
42     $("#navList li").eq(2).remove();
43     $("#navList li").eq(3).remove();
44     $("#MyLinks1_Syndication").append('<div style="position:relative;left:-10px;top:-45px"><img src="http://cdn1.iconfinder.com/data/icons/supra_rss/png/32%20x%2032/rss2_1-20.png"/></div>');
45     $("#navList li").eq(0).remove();
46 });
47 
48 /*左上角广告浮动*/
49 $(function(){
50     $(window).scroll(function(){
51         var ref_min=$(".RecentComment")[0];
52         if(!ref_min)return;
53         var scroll_top=$(window).scrollTop();
54         var ref_height_min=ref_min.offsetTop+ref_min.offsetHeight;
55         if(scroll_top>ref_height_min){
56             $(".focus-bar").addClass("fixed-bar");
57             $(".focus-ads").addClass("fixed-ads").animate({height:280},"slow");
58         }else{
59             $(".focus-bar").removeClass("fixed-bar");
60             $(".focus-ads").removeClass("fixed-ads");
61         }
62     });
63     if($(".pub_index").length>0){
64         $("#top_recom").clone().appendTo($(".focus-ads").empty()).show();
65     }
66 });

 

这是 http://www.cnblogs.com/lhb25/ 的自定义JS。

高手。

学习了。

posted @ 2013-10-25 22:07  过客代码站  阅读(301)  评论(0编辑  收藏  举报