Team:University College London/js/initjs
From 2012.igem.org
(Difference between revisions)
(7 intermediate revisions not shown) | |||
Line 37: | Line 37: | ||
// FOOTNOTES | // FOOTNOTES | ||
- | ucligem.append('<div id="footnote-box"></div>'); | + | ucligem.append('<div id="footnote-box"><span id="footnote-box-content"></span><div id="footnote-close"></div></div>'); |
var footnotebox = $('#footnote-box'); | var footnotebox = $('#footnote-box'); | ||
Line 51: | Line 51: | ||
var left = e.pageX - ucligem.offset().left - 150; // -150 as width is 300 | var left = e.pageX - ucligem.offset().left - 150; // -150 as width is 300 | ||
if(left < 0) { left = 0; } else if(left > 690) { left = 690; } | if(left < 0) { left = 0; } else if(left > 690) { left = 690; } | ||
- | + | footnotebox.css({"left":left,"top":e.pageY+30}); | |
$.ajax({ | $.ajax({ | ||
- | url: "https://2012.igem.org/wiki/index.php?title=Team:University_College_London/ | + | url: "https://2012.igem.org/wiki/index.php?title=Team:University_College_London/Bibliography/"+title+"&action=raw", |
- | success: function(data){ | + | success: function(data){$('#footnote-box-content').html(data); footnotebox.show();}, |
}); | }); | ||
- | }); | + | }); |
+ | $('#footnote-close').click(function(){footnotebox.hide();}); | ||
}); | }); |
Latest revision as of 10:18, 9 August 2012
$(document).ready(function(){
$('#wikimenutoggleon').click(function(){ $('#top-section').show(); $('#wikimenutoggleoff').show(); $('#wikimenutoggleon').hide(); });
$('#wikimenutoggleoff').click(function(){
$('#top-section').hide(); $('#wikimenutoggleoff').hide(); $('#wikimenutoggleon').show(); });
var ucligem = $('#ucligem');
// GLOSSARY
ucligem.append('');var glossarybox = $('#glossary-box');
$('.glossary').each(function() {
$this = $(this); $.data(this, 'title', $this.attr('title')); $this.removeAttr('title'); });
$('.glossary').mouseenter(function(e){
var caller = $(this); var title = $.data(this,'title'); var left = e.pageX - ucligem.offset().left - 150; // -150 as width is 300 if(left < 0) { left = 0; } else if(left > 690) { left = 690; } glossarybox.css({"left":left,"top":e.pageY+30}); $.ajax({ url: "https://2012.igem.org/wiki/index.php?title=Team:University_College_London/Glossary/"+title+"&action=raw", success: function(data){glossarybox.text(data); glossarybox.show();}, }); }).mouseout(function(){glossarybox.hide();});
// FOOTNOTES
ucligem.append('');
var footnotebox = $('#footnote-box');
$('.footnote').each(function() {
$this = $(this); $.data(this, 'title', $this.attr('title')); $this.removeAttr('title'); });
$('.footnote').click(function(e){
var caller = $(this); var title = $.data(this,'title'); var left = e.pageX - ucligem.offset().left - 150; // -150 as width is 300 if(left < 0) { left = 0; } else if(left > 690) { left = 690; } footnotebox.css({"left":left,"top":e.pageY+30}); $.ajax({ url: "https://2012.igem.org/wiki/index.php?title=Team:University_College_London/Bibliography/"+title+"&action=raw", success: function(data){$('#footnote-box-content').html(data); footnotebox.show();}, }); });
$('#footnote-close').click(function(){footnotebox.hide();}); });