图像放大hover,内容在div框中附加到图像

我想知道是否有人可以指导我建立一个脚本,我可以通过鼠标hover来放大图像,但图像不仅会被放大,图像周围的div也会附加到它上面当你盘旋

谢谢!

最简单的方法。 将代码放在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选择器更改为您需要的任何内容。 请享用。