Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/367.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在jquery上调整鼠标上的图像大小_Javascript_Ruby On Rails - Fatal编程技术网

Javascript 在jquery上调整鼠标上的图像大小

Javascript 在jquery上调整鼠标上的图像大小,javascript,ruby-on-rails,Javascript,Ruby On Rails,我试图让每个图像在鼠标上方稍微增大,然后在jquery应用程序上的鼠标上减小。但是,每个图像的大小不同。如何使用javascript应用此效果,使每个图像按比例放大并恢复正常 在“高度/宽度”设置中使用加减修改器 下面的代码将在鼠标悬停时加/减20个像素 $(document).ready(function(){ $(".box").mouseover(function(){ $(this).animate({height:"+=20",width:"+=20"},"f

我试图让每个图像在鼠标上方稍微增大,然后在jquery应用程序上的鼠标上减小。但是,每个图像的大小不同。如何使用javascript应用此效果,使每个图像按比例放大并恢复正常



在“高度/宽度”设置中使用加减修改器

下面的代码将在鼠标悬停时加/减20个像素

$(document).ready(function(){
    $(".box").mouseover(function(){
        $(this).animate({height:"+=20",width:"+=20"},"fast");
    });
    $(".box").mouseout(function(){
        $(this).animate({height:"-=20",width:"-=20"},"fast");
    });
});

请不要冒昧地提出整个问题,这是不必要的
$(document).ready(function(){
    $(".box").mouseover(function(){
        $(this).animate({height:"+=20",width:"+=20"},"fast");
    });
    $(".box").mouseout(function(){
        $(this).animate({height:"-=20",width:"-=20"},"fast");
    });
});