Team:University College London/js/labbookjs

From 2012.igem.org

(Difference between revisions)
Line 44: Line 44:
           var id = window.location.hash;
           var id = window.location.hash;
     //      alert(id);
     //      alert(id);
-
           $(id).next().next().removeClass('experiment').addClass('experimenton');
+
           $(id).removeClass('experiment').addClass('experimenton');
-
           $(id).next().slideDown('normal');
+
           $(id).prev().slideDown('normal');
           $(id).find('.arrowlabel').text("hide details")
           $(id).find('.arrowlabel').text("hide details")
-
           document.getElementById(id.substr(1)).scrollIntoView();
+
           //document.getElementById(id.substr(1)).scrollIntoView();
}
}
   
   
});
});

Revision as of 19:06, 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).prev().slideDown('normal');
         $(id).find('.arrowlabel').text("hide details")
         //document.getElementById(id.substr(1)).scrollIntoView();

}


});