This question follows on from a previous question which can be found here: Need to fadeIn each circle 1 after the other with jQuery
Basically now when the 'Climate Change and energy' circle is clicked, I need to hide all the other circles apart from the clicked circle and show a sub set or other circles that follow the same path as the original circles. But the new circles start from the next point on from the clicked circle.
I have attached a picture of what needs to be shown when you click on the circle, which can be seen here: http://cl.ly/EO95
Here is the code that I attempted it with:
HTML:
<div class="circle_holder seventh">
<div class="circle pie">
<a href="#"><span>climate change and energy</span></a>
</div>
<div class="inner_circles hidden">
<div class="circle_holder eighth">
<div class="circle pie">
<a href="#"><span>energy efficiency</span></a>
</div>
</div>
<div class="circle_holder first">
<div class="circle pie">
<a href="#"><span>renewable energy</span></a>
</div>
</div>
<div class="circle_holder second">
<div class="circle pie">
<a href="#"><span>carbon finance</span></a>
</div>
</div>
<div class="circle_holder third">
<div class="circle pie">
<a href="#"><span>climate adaptation</span></a>
</div>
</div
<div class="circle_holder fourth">
<div class="circle pie">
<a href="#"><span>ghg footprint assessment</span></a>
</div>
</div
</div>
</div>
JS:
if ($.browser.msie || $.browser.version < 9) {
var circle = $('.circles .circle_holder > .circle');
$(circle).animate({
height: 168,
width: 168,
left: '0',
top: '0'
}, 1000);
if (window.PIE) {
$('.pie').each(function() {
PIE.attach(this);
});
}
}
$('.circles .circle_holder > .circle').each(function(i){
var time = 300 * (i + 1);
setTimeout(function(){
$('.circle').eq(i).addClass('open').animate({opacity: '1'}, i);
$('.circle a span').animate({opacity: '1'}, 4000);
}, time);
});
setTimeout(function() {
$('.circle').addClass('circles_loaded');
}, 3700);
$('.circles > .circle_holder > .circle').click( function(){
$('.inner_circles').removeClass('hidden', function() {
console.log($('.inner_circles').parent().hide());
$('.inner_circles').find().parent('.circle_holder').hide();
$('.inner_circles .circle').each(function(i){
var time = 300 * (i + 1);
setTimeout(function(){
$('.inner_circles .circle').eq(i).addClass('open').animate({opacity: '1'}, i);
$('.inner_circles .circle a span').animate({opacity: '1'}, 4000);
}, time);
});
});
});
Here is a link to a jsFiddle containing all the HTML/CSS & JS: http://jsfiddle.net/thomasbritton/wV867/
If anyone could help me out with this I would very much appreciate it as have been tearing my hair out over this for hours.
I am on skype if anyone would like to talk through it if it might help things.
Thanks