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