Team:University College London/js/labbookjs

From 2012.igem.org

(Difference between revisions)
 
(4 intermediate revisions not shown)
Line 2: Line 2:
// set up arrows.
// set up arrows.
-
var left=330;
+
$('.experiment').append('<div class="arrow" style="left:308px"></div>');
-
while(left < 380){
+
$('.experiment').append('<div class="arrow" style="left:650px"></div>');
-
      $('.experiment').append('<div class="arrow" style="left:'+left+'px"></div>');
+
-
      left = left+38;
+
-
}
+
-
var left=585;
+
-
while(left < 650){
+
-
      $('.experiment').append('<div class="arrow" style="left:'+left+'px"></div>');
+
-
      left = left+38;
+
-
}
+
-
$('.experiment').append('<div class="arrowlabel">SHOW DETAILS</div>');
+
$('.experiment').append('<div class="arrowlabel">CLICK FOR MORE DETAILS</div>');
$('.protocol').append('<div class="arrow"></div>');
$('.protocol').append('<div class="arrow"></div>');
Line 20: Line 12:
if($(this).prev().is(':hidden') == true) {
if($(this).prev().is(':hidden') == true) {
$(this).removeClass('experiment').addClass('experimenton');
$(this).removeClass('experiment').addClass('experimenton');
-
                         $(this).find('.arrowlabel').text("HIDE DETAILS");
+
                         $(this).find('.arrowlabel').text("CLICK TO HIDE DETAILS");
                         $(this).prev().slideDown('normal');
                         $(this).prev().slideDown('normal');
}else{
}else{
                         $(this).addClass('experiment').removeClass('experimenton');
                         $(this).addClass('experiment').removeClass('experimenton');
-
                         $(this).find('.arrowlabel').text("SHOW DETAILS");
+
                         $(this).find('.arrowlabel').text("CLICK FOR MORE DETAILS");
                 $(this).prev().slideUp('normal');  
                 $(this).prev().slideUp('normal');  
  }
  }
Line 45: Line 37:
           $(id).next().next().removeClass('experiment').addClass('experimenton');
           $(id).next().next().removeClass('experiment').addClass('experimenton');
           $(id).next().show();
           $(id).next().show();
-
           $(id).next().next().find('.arrowlabel').text("HIDE DETAILS");
+
           $(id).next().next().find('.arrowlabel').text("CLICK TO HIDE DETAILS");
           document.getElementById(id.substr(1)).scrollIntoView(true);
           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);
}


});