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. | ||
- | + | $('.experiment').append('<div class="arrow" style="left:308px"></div>'); | |
- | + | $('.experiment').append('<div class="arrow" style="left:650px"></div>'); | |
- | + | ||
- | + | $('.experiment').append('<div class="arrowlabel">CLICK FOR MORE DETAILS</div>'); | |
- | + | ||
+ | $('.protocol').append('<div class="arrow"></div>'); | ||
$('.experiment').click(function() { | $('.experiment').click(function() { | ||
- | |||
- | |||
- | |||
- | |||
- | |||
if($(this).prev().is(':hidden') == true) { | if($(this).prev().is(':hidden') == true) { | ||
- | $(this).addClass(' | + | $(this).removeClass('experiment').addClass('experimenton'); |
- | + | $(this).find('.arrowlabel').text("CLICK TO HIDE DETAILS"); | |
- | $(this). | + | $(this).prev().slideDown('normal'); |
- | $(this). | + | }else{ |
- | + | $(this).addClass('experiment').removeClass('experimenton'); | |
- | + | $(this).find('.arrowlabel').text("CLICK FOR MORE DETAILS"); | |
- | $(this). | + | $(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); }
});