Template:Team:Hannover/new main.tmpl

From 2014.igem.org

(Difference between revisions)
Line 9: Line 9:
function annotate_all() {
function annotate_all() {
-
$( ".annotation" ).each(function(elem) {
+
// Move all annotations to the height of the referred element.
-
  var e = $(this).attr('ref');
+
$( ".annotation" ).each(function(elem) {
-
  var thise = $(this);
+
  var thise = $(this);
-
  var apos = $(this).offset();
+
  var e = thise.attr('ref');
-
  var reff = $('#' + e);
+
  var reff = $('#' + e);
-
  var rpos = reff.offset();
+
  if (reff) {
-
  var opos = thise.position();
+
    var apos = thise.offset();  
-
  opos.top = opos.top - apos.top + rpos.top;
+
    var rpos = reff.offset();
-
 
+
    var opos = thise.position();
-
  thise.css({
+
    opos.top = opos.top - apos.top + rpos.top - 10;
-
    'position' : 'absolute' ,  
+
    thise.css({
-
    'top' : opos.top,
+
      'vi' : 'absolute' ,  
-
    'left' : opos.left
+
      'top' : opos.top,
-
  });
+
      'left' : opos.left
-
   console.log(opos.top);
+
    });
-
  console.log(rpos.top);
+
   }
-
 
+
-
  console.log(opos.top);
+
-
  thise.position(opos);
+
-
  var opos2 = thise.position();
+
-
  console.log(opos2);
+
});
});
Line 40: Line 35:
}
}
 +
function onready() {
 +
    annotate_all();
// Preload images..
// Preload images..
preload([
preload([
Line 48: Line 45:
     'https://static.igem.org/mediawiki/2014/0/06/20140909_MENU-NEW-TEAM.gif'
     'https://static.igem.org/mediawiki/2014/0/06/20140909_MENU-NEW-TEAM.gif'
]);
]);
 +
}
 +
 +
$( document ).ready( onready );
</script>
</script>
</body>
</body>
</html>
</html>

Revision as of 16:31, 11 September 2014