跪求javascript控制背景图片大小(鼠标滚轮控制) 有两张图片,一张为背景图片 要用javascript控制背景图片的大小。用鼠标滚轮控制。 另外一张要放在背景图片上面。 就像是百度地图似的。 不管背景图片如何放大 另外一张图片一直定点在某个位置。随之背景图片的大小而移动。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <SCRIPT language=JavaScript type=text/JavaScript> //改变图片大小 function resizepic(o) { var maxwidth=550; //定义最大宽度 var maxheight=800; //定义最大高度 var a=new Image(); a.src=o.src if(a.width > maxwidth) { o.style.width=maxwidth; } if (a.height> maxheight) { o.style.height=maxheight; } } //无级缩放图片大小 function bbimg(o) { var zoom=parseInt(o.style.zoom, 10)||100; zoom+=event.wheelDelta/12; if (zoom>0) o.style.zoom=zoom+'%'; return false; } </SCRIPT> 对于那个固定不动的,设置css属性,position;fixed就可以了 楼上的大哥, 不是要固定不动, 而是要根据背景图片的大小 来移动位置。 就好比是拿javascript做出百度地图那种效果。 鼠标滚轮的事件只有IE支持onmousewheel <IMG id='img1' src='356173.gif' onmousewheel = 'wheel(this)' style='width:10px' /><SCRIPT>function wheel(obj){ var width = parseInt(obj.style.width); if (event.wheelDelta > 0) { obj.style.width = (width + 10) + 'px'; } else { obj.style.width = (width - 10) + 'px'; }}</SCRIPT>鼠标滚轮控制图片大小,只有IE能做 帮一下 JS 的 密码框中直接确认键的功能 求救 ie6/7/8 innerHTML 失效 求在谷歌浏览器下获取客户端mac地址的js或者jquery方法 关于html控件中的函数的用法 ,急啊 浏览器的快捷键Ctrl+N是“新建窗口”,如何屏蔽 如何得到网页里的控件的文本输入框的值? 相对宽度(比如98%)如何转换为绝对宽度567px? 连接sql server数据库问题急急急急急急急急急 不知在javascipt中这段代码有何问题? div中滚动显示一些数据 用JavaScript做的网站可以保存资料吗?若能应该怎么做?
<SCRIPT language=JavaScript type=text/JavaScript>
//改变图片大小
function resizepic(o)
{
var maxwidth=550; //定义最大宽度
var maxheight=800; //定义最大高度
var a=new Image();
a.src=o.src
if(a.width > maxwidth)
{
o.style.width=maxwidth;
}
if (a.height> maxheight)
{
o.style.height=maxheight;
}
}
//无级缩放图片大小
function bbimg(o)
{
var zoom=parseInt(o.style.zoom, 10)||100;
zoom+=event.wheelDelta/12;
if (zoom>0) o.style.zoom=zoom+'%';
return false;
}
</SCRIPT>
对于那个固定不动的,设置css属性,position;fixed就可以了
就好比是拿javascript做出百度地图那种效果。
onmousewheel
<IMG id='img1' src='356173.gif' onmousewheel = 'wheel(this)' style='width:10px' />
<SCRIPT>
function wheel(obj)
{
var width = parseInt(obj.style.width);
if (event.wheelDelta > 0)
{
obj.style.width = (width + 10) + 'px';
}
else
{
obj.style.width = (width - 10) + 'px';
}
}
</SCRIPT>鼠标滚轮控制图片大小,只有IE能做