Team:University College London/js/labbookjs

From 2012.igem.org

(Difference between revisions)
 
(74 intermediate revisions not shown)
Line 2: Line 2:
// set up arrows.
// set up arrows.
-
var left=4;
+
$('.experiment').append('<div class="arrow" style="left:308px"></div>');
-
while(left < 980){
+
$('.experiment').append('<div class="arrow" style="left:650px"></div>');
-
      $('.experiment').append('<div class="arrow" style="left:'+left+'px"></div>');
+
 
-
      left = left+38;
+
$('.experiment').append('<div class="arrowlabel">CLICK FOR MORE DETAILS</div>');
-
}
+
 
 +
$('.protocol').append('<div class="arrow"></div>');
$('.experiment').click(function() {
$('.experiment').click(function() {
-
         
 
-
$('.experiment').removeClass('on');
 
-
   
 
-
$('.experimentContent').slideUp('normal');
 
-
 
 
if($(this).prev().is(':hidden') == true) {
if($(this).prev().is(':hidden') == true) {
-
$(this).addClass('on');
+
$(this).removeClass('experiment').addClass('experimenton');
-
                          
+
                         $(this).find('.arrowlabel').text("CLICK TO HIDE DETAILS");
-
                         $(this).children().removeClass('arrow');
+
                         $(this).prev().slideDown('normal');
-
                         $(this).children().addClass('arrow-up');
+
}else{
-
                   
+
                        $(this).addClass('experiment').removeClass('experimenton');
-
 
+
                         $(this).find('.arrowlabel').text("CLICK FOR MORE DETAILS");
-
$(this).prev().slideDown('normal');
+
                $(this).prev().slideUp('normal');  
-
}  
+
  }
 +
});
 +
 
 +
 
 +
$('.protocol').click(function() {
 +
          if($(this).next().is(':hidden') == true) {
 +
$(this).removeClass('protocol').addClass('protocolon');
 +
                        $(this).next().slideDown('normal');
 +
}else{
 +
                        $(this).addClass('protocol').removeClass('protocolon');
 +
                $(this).next().slideUp('normal');
 +
  }
   
   
});
});
 +
 +
if(window.location.hash){
 +
          var id = window.location.hash;
 +
          $(id).next().next().removeClass('experiment').addClass('experimenton');
 +
          $(id).next().show();
 +
          $(id).next().next().find('.arrowlabel').text("CLICK TO HIDE DETAILS");
 +
          document.getElementById(id.substr(1)).scrollIntoView(true);
 +
}
 +
   
   
});
});

Latest revision as of 15:41, 29 August 2012

$(document).ready(function(){

// set up arrows.

$('.experiment').append('
'); $('.experiment').append('
'); $('.experiment').append('
CLICK FOR MORE DETAILS
'); $('.protocol').append('
');

$('.experiment').click(function() { if($(this).prev().is(':hidden') == true) { $(this).removeClass('experiment').addClass('experimenton');

                       $(this).find('.arrowlabel').text("CLICK TO HIDE DETAILS");
                       $(this).prev().slideDown('normal');

}else{

                        $(this).addClass('experiment').removeClass('experimenton');
                       $(this).find('.arrowlabel').text("CLICK FOR MORE DETAILS");
        	        $(this).prev().slideUp('normal'); 

} });


$('.protocol').click(function() {

          if($(this).next().is(':hidden') == true) {			

$(this).removeClass('protocol').addClass('protocolon');

                       $(this).next().slideDown('normal');

}else{

                        $(this).addClass('protocol').removeClass('protocolon');
        	        $(this).next().slideUp('normal'); 

}

});

if(window.location.hash){

         var id = window.location.hash;
         $(id).next().next().removeClass('experiment').addClass('experimenton');
         $(id).next().show();
         $(id).next().next().find('.arrowlabel').text("CLICK TO HIDE DETAILS");
         document.getElementById(id.substr(1)).scrollIntoView(true);
}


});