本文實例講述了jQuery實現(xiàn)的鼠標(biāo)滾輪控制圖片縮放功能。分享給大家供大家參考,具體如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>www.survivalescaperooms.com 鼠標(biāo)滾輪控制圖片縮放</title><script type="text/javascript" src="jquery-1.7.2.min.js"></script><script type="text/javascript">$(function() { function zoomImg(o) { var zoom = parseInt(o.style.zoom, 10) || 100; zoom += event.wheelDelta / 2; //可適合修改 if (zoom > 0) o.style.zoom = zoom + '%'; } $(document).ready(function() { $("img").bind("mousewheel", function() { zoomImg(this); return false; }); });})</script></head><body><center><img src="1.jpg"/></center></body></html>運行效果:

更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery圖片操作技巧大全》、《jQuery切換特效與技巧總結(jié)》、《jQuery擴展技巧總結(jié)》、《jQuery常見經(jīng)典特效匯總》及《jquery選擇器用法總結(jié)》
希望本文所述對大家jQuery程序設(shè)計有所幫助。
新聞熱點
疑難解答