Reputation:
I wrote this and it works how it supposed to but I'm not sure how to get this effect only on the div with class .pro-slika I'm hovering on and not on all classes named .pro-slika
$(document).ready(function() {
$('.pro-slika').hover(function() {
$('.crna-tran').fadeToggle();
$('.websitename').slideToggle();
$('.lupo').fadeToggle();
});
});
I know I'm supposed to use 'this' but not sure how.
Upvotes: 0
Views: 24
Reputation: 27823
Asuming your .crna-tran
and other classes are found inside the .pro-slika
class, you can do this:
$(document).ready(function() {
$('.pro-slika').hover(function() {
var $hoveredEl = $(this);
$hoveredEl.find('.crna-tran').fadeToggle();
$hoveredEl.find('.websitename').slideToggle();
$hoveredEl.find('.lupo').fadeToggle();
});
});
Upvotes: 2