I am trying to create an event where click the button will display the menu, but since each module has such a button, when I click button of other div, the current menu stays on, is there any way to solve this?
I tried to create some even in the first part of the toggle but it cause more problem: I need to click twice the other button to make it appear...
html:
<ul>
<li class="item">
<div class="portfolio-image-wrapper">
<a class="hideModelLink" href="#">ModelLink</a>
<img src="assets/img/gallery/2.jpg" alt="" />
<div class="edit-menu">
<a href="#" target="_blank">Rename</a>
<a href="#" target="_blank">Delete</a>
</div>
<div class="item-info-overlay"></div>
</div>
<div class="item-info">
<h4 class="text-dark no-margin title semi-bold"><a class="" target="_blank" href="#">Creative Illustration</a></h4>
<p>3/21/2014</p>
</div>
<a class="edit-button"></a>
</li>
...
</ul>
js:
$('.edit-button').toggle(function(){
$(this).siblings('.portfolio-image-wrapper').find('.edit-menu').css({
display: 'block'
});
$(this).siblings('.portfolio-image-wrapper').find('.item-info-overlay').css({
background: 'none'
});
$(this).css({
'background-color': '#f5f5f5'
});
},
function(){
$(this).siblings('.portfolio-image-wrapper').find('.edit-menu').css({
display: 'none'
});
$(this).siblings('.portfolio-image-wrapper').find('.item-info-overlay').css({
background: 'rgba(153, 153, 153, 0.2)'
});
$(this).css({
'background-color': '#ffffff'
});
});