Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.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
如何在图像标题上启用jqueryforeach?_Jquery - Fatal编程技术网

如何在图像标题上启用jqueryforeach?

如何在图像标题上启用jqueryforeach?,jquery,Jquery,我使用jQuery在图像上设置一些标题的动画: $(document).ready(function() { $('.box').mouseenter(function(){ $('.caption').stop().animate({height: "90%"}); }); $('.box').mouseleave(function(){ $('.caption').stop().animate({height: "1

我使用jQuery在图像上设置一些标题的动画:

$(document).ready(function() {
    $('.box').mouseenter(function(){
            $('.caption').stop().animate({height: "90%"});
    }); 

    $('.box').mouseleave(function(){
            $('.caption').stop().animate({height: "15%"},  2500, function() {
            });
    });
    });
HTML:


一个
在

只适用于一个图像。然而,我确实希望有更多,但目前在mouseenter上,所有的字幕都是动画

我怎样才能让它为每个人单独工作

使用
$(this)
引用与事件相关的元素:

$('.box').mouseenter(function(){
    $(this).find('.caption').stop().animate({height: "90%"});
}); 

$('.box').mouseleave(function(){
    $(this).find('.caption').stop().animate({height: "15%"},  2500, function() {
        });
});
使用
$(this)
引用与事件相关的元素:

$('.box').mouseenter(function(){
    $(this).find('.caption').stop().animate({height: "90%"});
}); 

$('.box').mouseleave(function(){
    $(this).find('.caption').stop().animate({height: "15%"},  2500, function() {
        });
});

提供html代码。@Kinduser完成:-)提供html代码。@Kinduser完成:-)