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").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').toggle(
+
$('#mutantwidget td').click(
function() {
function() {
-
$(this).addClass("selement");
+
                        if($(this).hasClass("selected"))
-
$('#mw_sequencearea').children().eq($(this).parent().index()).show();
+
{
-
},
+
$(this).removeClass("selected");
-
function() {
+
$('#mw_sequencearea').children().eq($(this).parent().index()).hide();
-
$(this).removeClass("selement");
+
if(selectedelements[0] == $(this))
-
$('#mw_sequencearea').children().eq($(this).parent().index()).hide();
+
{
 +
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-width:3px;
 
-
border-style:solid;
 
border-radius: 5px;
border-radius: 5px;
height: 400px;
height: 400px;
Line 67: Line 81:
padding: 5px;
padding: 5px;
cursor:pointer;
cursor:pointer;
-
border: 2px;
+
color:rgba(225, 225, 225, 1);
 +
background: rgba(0,0,0,.6);
 +
border-radius:5px;
}
}
-
#mutantwidget td.selement{
+
#mutantwidget td.selected{
-
background: #fa0;
+
 
}
}

Revision as of 18:26, 21 September 2011