Team:University College London/js/labbookjs

From 2012.igem.org

(Difference between revisions)
Line 42: Line 42:
if(window.location.hash){
if(window.location.hash){
-
           var id = window.location.hash.substr(1);
+
           var id = window.location.hash;
-
        // alert(window.location.hash);
+
          alert(id);
-
           $(id).removeClass('protocol').addClass('protocolon');
+
           $(id).removeClass('experiment').addClass('experimenton');
           $(id).next().slideDown('normal');
           $(id).next().slideDown('normal');
           document.getElementById('7-1').scrollIntoView();
           document.getElementById('7-1').scrollIntoView();

Revision as of 18:22, 1 August 2012

$(document).ready(function(){

// set up arrows. var left=330; while(left < 380){

$('.experiment').append('
');
     left = left+38;

} var left=585; while(left < 650){

$('.experiment').append('
');
     left = left+38;

}

$('.experiment').append('
show details
'); $('.protocol').append('
');

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

                       $(this).find('.arrowlabel').text("hide details");
                       $(this).prev().slideDown('normal');

}else{

                        $(this).addClass('experiment').removeClass('experimenton');
                       $(this).find('.arrowlabel').text("show 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;
          alert(id);
         $(id).removeClass('experiment').addClass('experimenton');
         $(id).next().slideDown('normal');
         document.getElementById('7-1').scrollIntoView();

}


});