无为清净楼资源网 Design By www.qnjia.com
//interval变量
var inl = [];
//原始透明度
var opa = 100;
//判断浏览器
var ie = navigator.appName == "Microsoft Internet Explorer" ? "Microsoft Internet Explorer" : "";
//缩小和打开按纽
function gogo() {
speed = 50;
var mode;
//利用方块的display来判定是否缩小或放大
if(!$('tmp').style.display) {
mode = "-";
//display是正常的话设置interval缩小
inl['suotu'] = setInterval("suodi('-')", 10);
}else {
mode = "+";
//display是none的话先把display改回去正常,再设置interval放大
$('tmp').style.display = "";
inl['suotu'] = setInterval("suodi('+')", 10);
}
clearInterval(inl['dcdr']);
inl['dcdr'] = setInterval("dcdr('" + mode + "')", 10);
}
//淡出淡入
function dcdr(op) {
//获取透明度
opa = define(op, opa, 4, 0, 100);
//更新透明度
ie ? $('tmp').style.filter = "alpha(opacity=" + opa + ")" : $('tmp').style.opacity = opa / 100;
//如果透明度小于等于0或大于等于100
if(opa <= 0 || opa >= 100) {
//停止interval
clearInterval(inl['dcdr']);
}
}
function define(id, a, b, a2, a3) {
if(id == "-") {
a -= b;
if(a <= a2) {
a = a2;
}
}else {
a += b;
if(a >= a3) {
a = a3;
}
}
return a;
}
//缩小或放大
function suodi(opt) {
//速度大于1的话继续除以s,否则等于1
speed = speed > 1 ? speed * 0.862 : 1;
//获取高度
var hw = define(opt, $('tmp').clientHeight, speed, speed, 300);
//设定高度和宽度
$('tmp').style.height = hw + "px";
$('tmp').style.width = hw + "px";
//假如方块的高度小于速度
if($('tmp').clientHeight <= speed) {
//隐藏方块
$('tmp').style.display = "none";
//按钮名字改为"打开"
$('anniu').value = "打开";
//关闭interval
clearInterval(inl['suotu']);
}else if($('tmp').clientWidth >= 300) {
//按钮名字改为"缩小"
$('anniu').value = "缩小";
//关闭interval
clearInterval(inl['suotu']);
}
}
//简化getElementById为$
var $ = function($) {
return document.getElementById($);
}
//interval变量
var inl = [];
//原始透明度
var opa = 100;
//判断浏览器
var ie = navigator.appName == "Microsoft Internet Explorer" ? "Microsoft Internet Explorer" : "";
//缩小和打开按纽
function gogo() {
speed = 50;
var mode;
//利用方块的display来判定是否缩小或放大
if(!$('tmp').style.display) {
mode = "-";
//display是正常的话设置interval缩小
inl['suotu'] = setInterval("suodi('-')", 10);
}else {
mode = "+";
//display是none的话先把display改回去正常,再设置interval放大
$('tmp').style.display = "";
inl['suotu'] = setInterval("suodi('+')", 10);
}
clearInterval(inl['dcdr']);
inl['dcdr'] = setInterval("dcdr('" + mode + "')", 10);
}
//淡出淡入
function dcdr(op) {
//获取透明度
opa = define(op, opa, 4, 0, 100);
//更新透明度
ie ? $('tmp').style.filter = "alpha(opacity=" + opa + ")" : $('tmp').style.opacity = opa / 100;
//如果透明度小于等于0或大于等于100
if(opa <= 0 || opa >= 100) {
//停止interval
clearInterval(inl['dcdr']);
}
}
function define(id, a, b, a2, a3) {
if(id == "-") {
a -= b;
if(a <= a2) {
a = a2;
}
}else {
a += b;
if(a >= a3) {
a = a3;
}
}
return a;
}
//缩小或放大
function suodi(opt) {
//速度大于1的话继续除以s,否则等于1
speed = speed > 1 ? speed * 0.862 : 1;
//获取高度
var hw = define(opt, $('tmp').clientHeight, speed, speed, 300);
//设定高度和宽度
$('tmp').style.height = hw + "px";
$('tmp').style.width = hw + "px";
//假如方块的高度小于速度
if($('tmp').clientHeight <= speed) {
//隐藏方块
$('tmp').style.display = "none";
//按钮名字改为"打开"
$('anniu').value = "打开";
//关闭interval
clearInterval(inl['suotu']);
}else if($('tmp').clientWidth >= 300) {
//按钮名字改为"缩小"
$('anniu').value = "缩小";
//关闭interval
clearInterval(inl['suotu']);
}
}
//简化getElementById为$
var $ = function($) {
return document.getElementById($);
}
<body style="margin:0; padding:100px 150px" style="margin:0; padding:100px 150px">
<table style="border:1px solid #ccc" style="border:1px solid #ccc">
<tr>
<td><div style="position:absolute; font-family:'微软雅黑'; font-size:13px" style="position:absolute; font-family:'微软雅黑'; font-size:13px"> 演示</div><div id="tmp" style="height:300px; width:300px; background:black"></div></td>
</tr>
<tr>
<td align="center" style="padding-top:20px" style="padding-top:20px">
<input id="anniu" type="button" value="缩小" style="font-family:'微软雅黑'; font-size:12px; font-weight:bold; border:1px solid #ccc" style="font-family:'微软雅黑'; font-size:12px; font-weight:bold; border:1px solid #ccc" onfocus="this.blur()" onclick="gogo()"/>
</td>
</tr>
</table>
</body>
[Ctrl+A 全选 注:引入外部Js需再刷新一下页面才能执行]
var inl = [];
//原始透明度
var opa = 100;
//判断浏览器
var ie = navigator.appName == "Microsoft Internet Explorer" ? "Microsoft Internet Explorer" : "";
//缩小和打开按纽
function gogo() {
speed = 50;
var mode;
//利用方块的display来判定是否缩小或放大
if(!$('tmp').style.display) {
mode = "-";
//display是正常的话设置interval缩小
inl['suotu'] = setInterval("suodi('-')", 10);
}else {
mode = "+";
//display是none的话先把display改回去正常,再设置interval放大
$('tmp').style.display = "";
inl['suotu'] = setInterval("suodi('+')", 10);
}
clearInterval(inl['dcdr']);
inl['dcdr'] = setInterval("dcdr('" + mode + "')", 10);
}
//淡出淡入
function dcdr(op) {
//获取透明度
opa = define(op, opa, 4, 0, 100);
//更新透明度
ie ? $('tmp').style.filter = "alpha(opacity=" + opa + ")" : $('tmp').style.opacity = opa / 100;
//如果透明度小于等于0或大于等于100
if(opa <= 0 || opa >= 100) {
//停止interval
clearInterval(inl['dcdr']);
}
}
function define(id, a, b, a2, a3) {
if(id == "-") {
a -= b;
if(a <= a2) {
a = a2;
}
}else {
a += b;
if(a >= a3) {
a = a3;
}
}
return a;
}
//缩小或放大
function suodi(opt) {
//速度大于1的话继续除以s,否则等于1
speed = speed > 1 ? speed * 0.862 : 1;
//获取高度
var hw = define(opt, $('tmp').clientHeight, speed, speed, 300);
//设定高度和宽度
$('tmp').style.height = hw + "px";
$('tmp').style.width = hw + "px";
//假如方块的高度小于速度
if($('tmp').clientHeight <= speed) {
//隐藏方块
$('tmp').style.display = "none";
//按钮名字改为"打开"
$('anniu').value = "打开";
//关闭interval
clearInterval(inl['suotu']);
}else if($('tmp').clientWidth >= 300) {
//按钮名字改为"缩小"
$('anniu').value = "缩小";
//关闭interval
clearInterval(inl['suotu']);
}
}
//简化getElementById为$
var $ = function($) {
return document.getElementById($);
}
//interval变量
var inl = [];
//原始透明度
var opa = 100;
//判断浏览器
var ie = navigator.appName == "Microsoft Internet Explorer" ? "Microsoft Internet Explorer" : "";
//缩小和打开按纽
function gogo() {
speed = 50;
var mode;
//利用方块的display来判定是否缩小或放大
if(!$('tmp').style.display) {
mode = "-";
//display是正常的话设置interval缩小
inl['suotu'] = setInterval("suodi('-')", 10);
}else {
mode = "+";
//display是none的话先把display改回去正常,再设置interval放大
$('tmp').style.display = "";
inl['suotu'] = setInterval("suodi('+')", 10);
}
clearInterval(inl['dcdr']);
inl['dcdr'] = setInterval("dcdr('" + mode + "')", 10);
}
//淡出淡入
function dcdr(op) {
//获取透明度
opa = define(op, opa, 4, 0, 100);
//更新透明度
ie ? $('tmp').style.filter = "alpha(opacity=" + opa + ")" : $('tmp').style.opacity = opa / 100;
//如果透明度小于等于0或大于等于100
if(opa <= 0 || opa >= 100) {
//停止interval
clearInterval(inl['dcdr']);
}
}
function define(id, a, b, a2, a3) {
if(id == "-") {
a -= b;
if(a <= a2) {
a = a2;
}
}else {
a += b;
if(a >= a3) {
a = a3;
}
}
return a;
}
//缩小或放大
function suodi(opt) {
//速度大于1的话继续除以s,否则等于1
speed = speed > 1 ? speed * 0.862 : 1;
//获取高度
var hw = define(opt, $('tmp').clientHeight, speed, speed, 300);
//设定高度和宽度
$('tmp').style.height = hw + "px";
$('tmp').style.width = hw + "px";
//假如方块的高度小于速度
if($('tmp').clientHeight <= speed) {
//隐藏方块
$('tmp').style.display = "none";
//按钮名字改为"打开"
$('anniu').value = "打开";
//关闭interval
clearInterval(inl['suotu']);
}else if($('tmp').clientWidth >= 300) {
//按钮名字改为"缩小"
$('anniu').value = "缩小";
//关闭interval
clearInterval(inl['suotu']);
}
}
//简化getElementById为$
var $ = function($) {
return document.getElementById($);
}
<body style="margin:0; padding:100px 150px" style="margin:0; padding:100px 150px">
<table style="border:1px solid #ccc" style="border:1px solid #ccc">
<tr>
<td><div style="position:absolute; font-family:'微软雅黑'; font-size:13px" style="position:absolute; font-family:'微软雅黑'; font-size:13px"> 演示</div><div id="tmp" style="height:300px; width:300px; background:black"></div></td>
</tr>
<tr>
<td align="center" style="padding-top:20px" style="padding-top:20px">
<input id="anniu" type="button" value="缩小" style="font-family:'微软雅黑'; font-size:12px; font-weight:bold; border:1px solid #ccc" style="font-family:'微软雅黑'; font-size:12px; font-weight:bold; border:1px solid #ccc" onfocus="this.blur()" onclick="gogo()"/>
</td>
</tr>
</table>
</body>
[Ctrl+A 全选 注:引入外部Js需再刷新一下页面才能执行]
标签:
Javascript,动态伸缩
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
2024年11月16日
2024年11月16日
- 罗大佑1982《之乎者也》无法盗版的青春套装版 [WAV+CUE][1G]
- 曾庆瑜1989-款款柔情[日本东芝版][WAV+CUE]
- Scelsi-IntegraledesquatuorsacordesetTrioacordes-QuatuorMolinari(2024)[24bit-WAV]
- 房东的猫2017-房东的猫[科文音像][WAV+CUE]
- 杨乃文.2016-离心力(引进版)【亚神音乐】【WAV+CUE】
- 群星.2024-珠帘玉幕影视原声带【TME】【FLAC分轨】
- 芝麻龙眼.2008-光阴隧道民歌记录3CD【乡城】【WAV+CUE】
- 谭艳《再度重相逢HQII》头版限量[低速原抓WAV+CUE][549M]
- ABC唱片《蔡琴三十周年纪念版》6N纯银镀膜 [WAV+CUE][1.1G]
- 海来阿木《西楼情歌》开盘母带[WAV+CUE][1.1G]
- TheGesualdoSix-QueenofHeartsLamentsandSongsofRegretforQueensTerrestrialandCele
- 王建杰2011-荣华富贵[喜玛拉雅][WAV+CUE]
- 孙悦2024-时光音乐会[金蜂][WAV+CUE]
- 秦宇子.2020-#YUZI【海蝶】【FLAC分轨】
- 苏有朋.1994-这般发生【华纳】【WAV+CUE】