"代码"找到 8篇
- 2010/10/17 新风格方案 Chromemenu
- 2010/03/19 茶屋优化 防止skin.html文件被下载,保护风格文件
- 2010/01/25 茶屋优化 给博客加上短讯息功能 ASP (8)
- 2010/01/07 茶屋优化 茶兔and茶鹿的对话
- 2009/12/23 茶屋优化 时钟 (2)
- 2009/12/23 茶屋优化 隐藏式BGM
- 2009/07/07 TC Plugin Flash标签云 (9)
- 2009/06/08 速度 (7)
这个也是在自己设计的风格中实现的功能之一,给标题导航添加chromemenu功能,现实更强的扩展,喜欢的同学可以自行添加。
效果图:
添加方法:
首先用记事本打开风格的skin.html文件在<head></head>之间添加如下功能代码
<!-- Chromemenu -->
<SCRIPT type=text/javascript>
<!--
//Chrome Drop Down Menu: Dynamic Drive (dynamicdrive.com)
var cssdropdown={
disappeardelay: 250, //set delay in miliseconds before menu disappears onmouseout
//No need to edit beyond here////////////////////////
dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all,
getposOffset:function(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
},
showhide:function(obj, e, visible, hidden){
if (this.ie || this.firefox)
this.dropmenuobj.style.left=this.dropmenuobj.style.top="-400px"
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
},
iecompattest:function(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
},
clearbrowseredge:function(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure) //move menu to the left?
edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset
var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
},
dropit:function(obj, e, dropmenuID){
if (this.dropmenuobj!=null) //hide previous menu
this.dropmenuobj.style.visibility="hidden"
this.clearhidemenu()
if (this.ie||this.firefox){
obj.onmouseout=function(){cssdropdown.delayhidemenu()}
this.dropmenuobj=document.getElementById(dropmenuID)
this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu()}
this.dropmenuobj.onmouseout=function(){cssdropdown.dynamichide(e)}
this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()}
this.showhide(this.dropmenuobj.style, e, "visible", "hidden")
this.dropmenuobj.x=this.getposOffset(obj, "left")
this.dropmenuobj.y=this.getposOffset(obj, "top")
this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"
}
},
contains_firefox:function(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
},
dynamichide:function(e){
var evtobj=window.event? window.event : e
if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
this.delayhidemenu()
else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
this.delayhidemenu()
},
delayhidemenu:function(){
this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'",this.disappeardelay)
},
clearhidemenu:function(){
if (this.delayhide!="undefined")
clearTimeout(this.delayhide)
}
}
//-->
</SCRIPT>
<!-- /Chromemenu -->
打开风格文件夹中的style.css文件,在文件中添加Chromemenu的式样代码,代码如下
/* ***** chromemenu ***** */
#chrome{
border-top:5px solid #eee;
border-bottom:5px solid #eee;
padding: 0px 0px 0px 0px;
margin: 0px 0px 5px 0px;
}
#chromemenu{
width: 800px;
}
#chromemenu:after{ /*Add margin between menu and rest of content in Firefox*/
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
#chromemenu ul{
border: 1px solid #DCDCDC;
width: 100%;
background: url(./images/chromebg.gif) center center repeat-x; /*Theme Change here*/
margin-left: 0;
padding-left: 0;
margin: 0;
float: left;
font: 11px tahoma;
}
#chromemenu ul li{
display: inline;
}
#chromemenu ul li a{
float: left;
color: #a9a9a9;
padding: 7px 20px 6px 15px;
text-decoration: none;
background: url(./images/divider.gif) center right no-repeat; /*Theme Change here*/
}
#chromemenu ul li a:hover{
color: #000000;
}
#chromemenu ul li a[onMouseover]:after{ /*HTML to indicate drop down link*/
content: " v";
/*content: " " url(downimage.gif); /*uncomment this line to use an image instead*/
}
.dropmenudiv{
position:absolute;
top: 0;
border: 1px solid #DCDCDC; /*Theme Change here*/
border-bottom-width: 0;
font:normal 11px tahoma;
line-height:18px;
z-index:100;
background-color: white;
width: 200px;
visibility: hidden;
filter: progid:DXImageTransform.Microsoft.Shadow(color=#CACACA,direction=135,strength=4); /*Add Shadow in IE. Remove if desired*/
}
.dropmenudiv a{
width: 100%;
display: block;
text-indent: 3px;
border-bottom: 1px solid #DCDCDC; /*Theme Change here*/
padding: 3px 20px 3px 15px;
text-decoration: none;
color: black;
}
.dropmenudiv a:hover{ /*Theme Change here*/
background-color: #F5F5F5;
}
继续编辑skin.html文件,在导航的代码之前添加如下的CSS式样id代码
<div id="chrome">
<div id="chromemenu">
将原来的TC导航代码修改成如下式样
<a href="[##_blog_link_##]category/" onMouseover="cssdropdown.dropit(this,event,'dropmenu1')">新鮮</a> :
最后我们对dropmenu1这个函数进行定义,这里可以对自己风格需要来进行发挥
案例代码:
<!--1nd dropmenu1 -->
<div id="dropmenu1" class="dropmenudiv" style="width: 200px;">
<s_rctps_rep>
<a href="[##_rctps_rep_link_##]"> [##_rctps_rep_title_##]</a>
</s_rctps_rep>
</div>
最后保存文件上传,刷新后即可看到效果。

最后在自己风格合适的位置贴上下面的代码即可(注意将代码里面的preview.swf和AC_RunActiveContent.js两个文件的地址换为自己的地址,如果不想下载文件包的话也可以直接使用下面的代码,调用本站的文件)
效果请查看本站的侧边栏Time模块,可以在width(宽)和height(高)处修改Flash的大小。
这篇文章只是用来做一个存档,方便以后调阅。
首先我们先下载Flash播放器的文件,注意此文件只能播放mp3格式的音频文件,其他格式的还没有试过,有心的朋友可以自己试试。
下载后解压上传到自己网站自己喜欢发目录,然后复制播放器的地址留着备用。
修改skin.html风格文件,在风格文件中搜索</s_t3>在下面加入如下代码,如果找不到</s_t3>也可以在</body>上添加。
<param name="movie" value="http://www.xtea.org/blog/attach/1/player.swf?son=http://www.xtea.org/down/01.mp3&autoplay=1" />
<param name="bgcolor" value="#ffffff">
</object>
将代码中的播放器地址换为自己上传的播放器地址,当然如果你懒得换的话可以直接使用本站的播放器地址;最后修改一下音乐地址为自己喜欢的歌曲地址保存skin.html文件后上传覆盖原来的风格文件,在后台清除一下缓存返回博客就可以看到效果了。



![]()