能伸展开和收缩的动态图层效果
2009-08-29 12:14
309 查看
<style>
#content {
font-size: 14px;
width: 200px;
height: 50px;
background: #eee;
padding: 10px;
border: 4px #ccc double;
overflow: hidden;
}
#key {
color: red;
float: right;
margin-top: -20px;
}
</style>
<script>
var s=5;
var minheight=50;
var maxheight=400;
function shoppingcat(){
var key = document.getElementById("key").innerText;
if(content.style.pixelHeight==0)content.style.pixelHeight=minheight;
if(key=="展开"){
content.style.pixelHeight+=s;
if(content.style.pixelHeight<maxheight){
setTimeout("shoppingcat();",1);
}else{
document.getElementById("key").innerText="关闭";
}
}else{
content.style.pixelHeight-=s;
if(content.style.pixelHeight>minheight){
setTimeout("shoppingcat();",1);
}else{
document.getElementById("key").innerText="展开";
}
}
}
</script>
<div id="content">
孤雁儿
<span id="key" onclick="shoppingcat();">展开</span><br><br>
世人作梅词,下笔便俗。予试作一篇,乃知前言不妄耳。<br><br>
藤床纸帐朝眠起,<br>
说不尽、无佳思。<br>
沈香烟断玉炉寒,<br>
伴我情怀如水。<br>
笛声三弄,<br>
梅心惊破,<br>
多少春情意。<br><br>
小风疏雨萧萧地,<br>
又催下、千行泪。<br>
吹箫人去玉楼空,<br>
肠断与谁同倚?
一枝折得,<br>
人间天上,<br>
没个人堪寄。
</div></font>
<a href="http://js.alixixi.com/">欢迎访问阿里西西网页特效代码站,js.alixixi.com</a>
#content {
font-size: 14px;
width: 200px;
height: 50px;
background: #eee;
padding: 10px;
border: 4px #ccc double;
overflow: hidden;
}
#key {
color: red;
float: right;
margin-top: -20px;
}
</style>
<script>
var s=5;
var minheight=50;
var maxheight=400;
function shoppingcat(){
var key = document.getElementById("key").innerText;
if(content.style.pixelHeight==0)content.style.pixelHeight=minheight;
if(key=="展开"){
content.style.pixelHeight+=s;
if(content.style.pixelHeight<maxheight){
setTimeout("shoppingcat();",1);
}else{
document.getElementById("key").innerText="关闭";
}
}else{
content.style.pixelHeight-=s;
if(content.style.pixelHeight>minheight){
setTimeout("shoppingcat();",1);
}else{
document.getElementById("key").innerText="展开";
}
}
}
</script>
<div id="content">
孤雁儿
<span id="key" onclick="shoppingcat();">展开</span><br><br>
世人作梅词,下笔便俗。予试作一篇,乃知前言不妄耳。<br><br>
藤床纸帐朝眠起,<br>
说不尽、无佳思。<br>
沈香烟断玉炉寒,<br>
伴我情怀如水。<br>
笛声三弄,<br>
梅心惊破,<br>
多少春情意。<br><br>
小风疏雨萧萧地,<br>
又催下、千行泪。<br>
吹箫人去玉楼空,<br>
肠断与谁同倚?
一枝折得,<br>
人间天上,<br>
没个人堪寄。
</div></font>
<a href="http://js.alixixi.com/">欢迎访问阿里西西网页特效代码站,js.alixixi.com</a>
相关文章推荐
- [ExtJS4]ExtJS4左边菜单面板收缩展开,右边TabPanel内容动态更新(解决宽度不能自适应问题)
- React中页面的收缩和展开效果
- 收缩展开效果
- JS+CSS实现DIV层的展开、收缩效果
- 文本区块收缩展开效果
- jquery简易收缩展开效果特效
- 菜单收缩展开效果(IE6/FF2)
- vuejs实现折叠面板展开收缩动画效果
- android ExpandableTextView-自定义可以动态展开/收缩显示长文本的TextView
- js 点击展开和收缩效果
- html页面内容的收缩和展开效果
- 产品类别收缩——展开新效果 COOKIE保存状态
- 图层动态伸缩效果
- jquery实现可横向和竖向展开的动态下滑菜单效果
- 在iframe里的页面编写js,实现在父窗口上创建动画效果展开和收缩的div(不变动iframe父窗口代码)
- Extjs展开和收缩动画效果造成问题
- 折叠展开收缩效果的栏目分类导航
- 层的展开收缩效果
- jquery学习第二天:超链接title提示效果、图片放大提示效果、内容展开收缩动画效果
- 滑动展开-收缩广告代码实例效果