Difference between revisions of "Team:UCLA/core/journaljs"

 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
jQuery(document).ready(function($){
 
jQuery(document).ready(function($){
   jQuery('.week-header').on('click', function(e){
+
   $('.week-header').on('click', function(){
 
   var values = this.id.split('-');
 
   var values = this.id.split('-');
   var target = '#' + value[0] + '-week-' + value[2] + '-content';
+
   var target = '#' + values[0] + '-week-' + values[2] + '-content';
   jQuery(target).slideToggle();
+
   $(target).slideToggle();
 +
  });
 +
 
 +
  $('.team').on('click', function(){
 +
  var active = new RegExp("team-active");
 +
if(active.test(this.className)) { return ;} else {
 +
  var team = this.id.split('-')[1];
 +
  if(team == 'pcage') {
 +
  $('#cdi-team-journal').fadeOut(300, function(){$('#pcage-team-journal').fadeIn(300);});
 +
  $('#team-pcage').addClass('team-active');
 +
        $('#team-cdi').removeClass('team-active');
 +
        $('#team-pcage').removeClass('team-inactive');
 +
  $('#team-cdi').addClass('team-inactive');
 +
  } else if (team == 'cdi') {
 +
  $('#pcage-team-journal').fadeOut(300, function(){$('#cdi-team-journal').fadeIn(300);});
 +
  $('#team-pcage').removeClass('team-active');
 +
  $('#team-cdi').addClass('team-active');
 +
        $('#team-pcage').addClass('team-inactive');
 +
        $('#team-cdi').removeClass('team-inactive');
 +
  }
 +
  }
 
   });
 
   });
 
});
 
});

Latest revision as of 22:18, 10 August 2016

jQuery(document).ready(function($){

 $('.week-header').on('click', function(){
 	var values = this.id.split('-');
 	var target = '#' + values[0] + '-week-' + values[2] + '-content';
 	$(target).slideToggle();
 });
 $('.team').on('click', function(){
 	var active = new RegExp("team-active");
		if(active.test(this.className)) { return ;} else {
 		var team = this.id.split('-')[1];

if(team == 'pcage') { $('#cdi-team-journal').fadeOut(300, function(){$('#pcage-team-journal').fadeIn(300);}); $('#team-pcage').addClass('team-active');

       $('#team-cdi').removeClass('team-active');
       $('#team-pcage').removeClass('team-inactive');

$('#team-cdi').addClass('team-inactive'); } else if (team == 'cdi') { $('#pcage-team-journal').fadeOut(300, function(){$('#cdi-team-journal').fadeIn(300);}); $('#team-pcage').removeClass('team-active'); $('#team-cdi').addClass('team-active');

       $('#team-pcage').addClass('team-inactive');
       $('#team-cdi').removeClass('team-inactive');

}

 	}
 });

});