Template:Team:UC Davis/MutantWidget
From 2011.igem.org
(Difference between revisions)
Line 1: | Line 1: | ||
<html> | <html> | ||
<script> | <script> | ||
+ | selectedelements = [null null]; | ||
+ | curelement = 0; | ||
$(document).ready(function(){ | $(document).ready(function(){ | ||
//Convert the ul to a table for some reason. | //Convert the ul to a table for some reason. | ||
- | $( | + | $("#mutantwidget").wrapInner("<table/>").wrapInner('<div id="mw_selectmenu"/>'); |
$('#mutantwidget h3').wrapInner('<td/>').children().unwrap().wrap('<tr/>'); | $('#mutantwidget h3').wrapInner('<td/>').children().unwrap().wrap('<tr/>'); | ||
$('#mutantwidget').prepend('<div id="mw_grapharea"/>'); | $('#mutantwidget').prepend('<div id="mw_grapharea"/>'); | ||
$('#mutantwidget').append('<div id="mw_sequencearea"/>'); | $('#mutantwidget').append('<div id="mw_sequencearea"/>'); | ||
$('#mutantwidget .sequence').hide().appendTo($('#mutantwidget #mw_sequencearea')); | $('#mutantwidget .sequence').hide().appendTo($('#mutantwidget #mw_sequencearea')); | ||
- | $('#mutantwidget td'). | + | $('#mutantwidget td').click( |
function() { | function() { | ||
- | $(this). | + | if($(this).hasClass("selected")) |
- | + | { | |
- | + | $(this).removeClass("selected"); | |
- | + | $('#mw_sequencearea').children().eq($(this).parent().index()).hide(); | |
- | $(this). | + | if(selectedelements[0] == $(this)) |
- | + | { | |
+ | curelement = 0; | ||
+ | } else | ||
+ | { | ||
+ | curelement = 1; | ||
+ | } | ||
+ | selectedelements[curelement] = null; | ||
+ | } else | ||
+ | { | ||
+ | selectedelements[curelement].removeClass("selected"); | ||
+ | $('#mw_sequencearea').children().eq($(this).parent().index()).hide(); | ||
+ | selectedelements[curelement] = $(this); | ||
+ | $(this).addClass("selected"); | ||
+ | $('#mw_sequencearea').children().eq($(this).parent().index()).show(); | ||
+ | } | ||
} | } | ||
); | ); | ||
Line 57: | Line 73: | ||
#mutantwidget { | #mutantwidget { | ||
position:relative; | position:relative; | ||
- | |||
- | |||
border-radius: 5px; | border-radius: 5px; | ||
height: 400px; | height: 400px; | ||
Line 67: | Line 81: | ||
padding: 5px; | padding: 5px; | ||
cursor:pointer; | cursor:pointer; | ||
- | border: | + | color:rgba(225, 225, 225, 1); |
+ | background: rgba(0,0,0,.6); | ||
+ | border-radius:5px; | ||
} | } | ||
- | #mutantwidget td. | + | #mutantwidget td.selected{ |
- | + | ||
} | } | ||
Revision as of 18:26, 21 September 2011