2011-07-09 45 views

回答

4

最簡單的方法。將代碼放在resizables.js文件的某處。

/** 
* Copyright 2012, Val Kotlarov Hoffman. 
* Licensed under the GPL Version 2 license. 
* You may copy freely and distribute as long as this comment remains. 
**/ 

$(document).ready(function(){ 
    init_resizeables(); 
}); 

function init_resizeables() { 

    $('img').hover(
     function() { 
      $(this).stop().animate({ 
       'width':'444px' 
      },{ 
       duration:234 
      }).css({ 
       'z-index':'999', 
       'position':'absolute' 
      }); 
     }, 
     function() { 
      $(this).stop().animate({ 
       'width':'254px' 
      },{ 
       duration:345 
      }).css({ 
       'z-index':'1' 
      }); 
     }); 
} 

第一個是放大圖像的寬度。第二個寬度是圖像的正常大小。只需將其包含在您的html文件中即可完成。更改img選擇器爲您需要的任何東西。 享受。