I have the HTML
structure as follows:
<div class="boxes workshops wrapl">
<a href="#" id="showw1" class="workshops-button lfloat">Show it</a>
</div>
<div class="boxes exhibitions">
<a href="#" id="showex1" class="exhibitions-button lfloat">Show it</a>
</div>
<div class="boxes gallery">
<a href="#" id="showex1" class="gallery-button lfloat">Show it</a>
</div>
The class .boxes
are squares set next to one another. There are about 30
boxes.
Initially all the boxes are set to opacity:1
and all the -button
class are set at opacity:0
.
However, then also if I hover my mouse inside the .boxes
, the links are clickable.
My .navi
menu:
<div id="navi">
<a href="#"><div id="t0"><span>Home</span></div></a>
<a href="#"><span>Events</span></a>
<a href="#"><span>Gallery</span></a>
<a href="#"><span>Exhibitions</span></a>
</div>
My javascript
code for changing the opacity
.
<script type="text/javascript">
var isHome = true;
$(function () {
$("#navi a").click(function() {
c = $(this).text().toLowerCase();
isHome = c=="home";
if (isHome){
$('.events-button, .workshops-button, .gallery-button, .sponsors-button, .hospitality-button, .lectures-button, .exhibitions-button').animate({opacity:0.0},500);
$(".boxes").animate({opacity: 1.0}, 500 );
} else {
$('.' + c).animate({opacity: 1.0}, 500 );
$('.' + c + "-button").animate({opacity: 1.0}, 500 ).addClass('activehack');
$('.activehack').not('.' + c + "-button").animate({opacity: 0.0}, 500 );
$('.boxes').not('.' + c).animate({opacity: 0.3}, 500 );
}
});
});
</script>
How can I remove the click
event of the -button
elements when they are not visible?
EDIT #1
I don't have to click the .-button
elements.
When I click home
, all .boxes
should appear, but the <a>..</a>
elements in each .boxes
must not be clickable.
Then if I click .events
, only the .boxes
with class: .events
should appear alongwith <a>...</a>
elements having .events-button
class[and they should be clickable now.]
The Jsfiddle is here.