请问谁有图片飘的代码,要鼠标在上面就停而且图片变浅的那种,有点象这个网站首页上的那个。

cicii 2002-03-19 03:39:03
请问谁有图片飘的代码,要鼠标在上面就停而且图片变浅的那种,有点象这个网站首页上的那个。
发到我的信箱里好吗?cicihome@263.net
谢谢!
...全文
73 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
catyycsdn 2002-03-21
  • 打赏
  • 举报
回复
把有该效果的页面另存为
再研究一下不就可以了吗
8988 2002-03-20
  • 打赏
  • 举报
回复
增加了超级链接
<script>
<!--
htmlurl="你的链拉地址";
imgpath="你的图片路径";
imgTrans="你的全透明图片路径";
imgWidth=30;//指定图片宽
imgHeight=30;//指定图片高
//注意:你的两张图片宽和高必须一样


document.write("<div id=img style=\"position: absolute; left: 0; top: 0;\" >");
document.write("<img width="+imgWidth+"height="+imgHeight+" id=SampleID src=\""+imgpath+"\" onmouseover=imgstop() onmouseout=imgstart() onclick=\"location='"+htmlurl+"'\" style=\"cursor:hand;filter:blendTrans(duration=0.2)\" >");
document.write("</div>");
var xPos = 20;
var yPos = document.body.clientHeight;
var step = 1;
var delay = 30;
var height = 0;
var Hoffset = 0;
var Woffset = 0;
var yon = 0;
var xon = 0;
var pause = true;
var interval;
img.style.top = yPos;
interval=null;

function start() {
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = img.offsetHeight;
Woffset = img.offsetWidth;
img.style.left = xPos + document.body.scrollLeft;
img.style.top = yPos + document.body.scrollTop;
if (yon) yPos = yPos + step;
else yPos = yPos - step;
if (yPos < 0) {yon = 1;yPos = 0;}
if (yPos >= (height - Hoffset)) {
yon = 0;
yPos = (height - Hoffset);
}
if (xon) xPos = xPos + step;
else xPos = xPos - step;
if (xPos < 0) { xon = 1;xPos = 0;}
if (xPos >= (width - Woffset)) {
xon = 0;
xPos = (width - Woffset);
}
interval=setTimeout("start()",delay);
}

function imgstart() {
SampleID.filters.blendTrans.Apply();
SampleID.src = imgpath;
SampleID.filters.blendTrans.Play()
interval = setTimeout('start()', delay);
}
function imgstop(){
SampleID.filters.blendTrans.Apply();
SampleID.src = imgTrans;
SampleID.filters.blendTrans.Play()
if(interval!=null) {clearTimeout(interval);interval=null}

}
start();

// End -->
</script>
cicii 2002-03-20
  • 打赏
  • 举报
回复
那怎么样给这个图片加上链接呢?
8988 2002-03-19
  • 打赏
  • 举报
回复
<script>
<!--
imgpath="你的图片路径";
imgTrans="你的全透明图片路径";
imgWidth=30;//指定图片宽
imgHeight=30;//指定图片高
//注意:你的两张图片宽和高必须一样


document.write("<div id=img style=\"position: absolute; left: 0; top: 0;\" >");
document.write("<img width="+imgWidth+"height="+imgHeight+" id=SampleID src=\""+imgpath+"\" onmouseover=imgstop() onmouseout=imgstart() style=\"filter:blendTrans(duration=0.2)\" >");
document.write("</div>");
var xPos = 20;
var yPos = document.body.clientHeight;
var step = 1;
var delay = 30;
var height = 0;
var Hoffset = 0;
var Woffset = 0;
var yon = 0;
var xon = 0;
var pause = true;
var interval;
img.style.top = yPos;
interval=null;

function start() {
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = img.offsetHeight;
Woffset = img.offsetWidth;
img.style.left = xPos + document.body.scrollLeft;
img.style.top = yPos + document.body.scrollTop;
if (yon) yPos = yPos + step;
else yPos = yPos - step;
if (yPos < 0) {yon = 1;yPos = 0;}
if (yPos >= (height - Hoffset)) {
yon = 0;
yPos = (height - Hoffset);
}
if (xon) xPos = xPos + step;
else xPos = xPos - step;
if (xPos < 0) { xon = 1;xPos = 0;}
if (xPos >= (width - Woffset)) {
xon = 0;
xPos = (width - Woffset);
}
interval=setTimeout("start()",delay);
}

function imgstart() {
SampleID.filters.blendTrans.Apply();
SampleID.src = imgpath;
SampleID.filters.blendTrans.Play()
interval = setTimeout('start()', delay);
}
function imgstop(){
SampleID.filters.blendTrans.Apply();
SampleID.src = imgTrans;
SampleID.filters.blendTrans.Play()
if(interval!=null) {clearTimeout(interval);interval=null}

}
start();

// End -->
</script>

87,994

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧