javascript - jquery mousover target each element -
javascript - jquery mousover target each element -
i want when hover on .project, want p tag appear. code have written shows of p tag every project @ same time. how can when have on project p under project appears. without adding classes?
$(document).ready(function() { $('.project').hover( function () { $('.project p').css({"visibility":"visible"}); }, function () { $('.project p').css({"visibility":"hidden"}); } );
});
you need utilize this
keyword, , need utilize find()
?
$(document).ready(function() { $('.project').hover( function () { $(this).find('p').css({"visibility":"visible"}); }, function () { $(this).find('p').css({"visibility":"hidden"}); } ); });
here's way it
$('.project').on('mouseenter mouseleave', function(e) { $('p', this).css('visibility', e.type == 'mouseenter' ? 'visible' : 'hidden'); });
javascript jquery html css hover
Comments
Post a Comment