1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
//图片自动调整的模式,1为按比例调整 ,2 按大小调整。 var resizemode = 1 function imgresize(o) { if (resizemode == 2 || o.onmousewheel) { if (o.width > 500) { o.style.width = '500px'; } if (o.height > 800) { o.style.height = '800px'; } } else { var parentNode = o.parentNode.parentNode if (parentNode) { if (o.offsetWidth >= parentNode.offsetWidth) o.style.width = '98%'; } else { var parentNode = o.parentNode if (parentNode) { if (o.offsetWidth >= parentNode.offsetWidth) o.style.width = '98%'; } } } } function bbimg(o) { var zoom = parseInt(o.style.zoom, 10) || 100; zoom += event.wheelDelta / 12; if (zoom > 0) o.style.zoom = zoom + '%'; return false; } function imgzoom(img, maxsize) { var a = new Image(); a.src = img.src if (a.width > maxsize * 4) { img.style.width = maxsize; } else if (a.width >= maxsize) { img.style.width = Math.round(a.width * Math.floor(4 * maxsize / a.width) / 4); } return false; } |