I have the following code in repeat.
<div class="background1"></div>
<i class="fa fa-share" alt="share" title="Share"></i>
<div class="large1">
<div class="ttip">
<div>Here goes contents...</div>
<span class="note">(click here to close the box)</span>
</div>
</div>
I want to display the div with class large1 and the background. This is the code (not mine. found it on net) in repeat.
I tried to do the following in java-script
$('.fa-share').click(function (){
$(this).next(".large1").first().html(function() {
$(this).prev(".background1").css({"opacity": "0.3"}).fadeIn("slow");
$(this).next('.ttip').css({left: $(this).position() + '20px',top: $(this).position() + '50px'}).show(500)
}).fadeIn("slow");
$(this).next('.note').on('click', function() {
$(this).prev('.ttip').hide(500);
$(this).prev(".background1").fadeOut("slow");
$(this).prev(".large1").fadeOut("slow");
});
});
I had tried using ".each()" on first click but did not work. Thanks in advance.
.large1is not a child of youri- instead offindtry.next(".large1").nextsearches for siblings right? But in my case those are not siblings.$(this).closest(".background1")won't work..background1should be a parent for$(this)element.