Team:University College London/js/initjs

From 2012.igem.org

(Difference between revisions)
Line 37: Line 37:
// FOOTNOTES
// FOOTNOTES
-
ucligem.append('<div id="footnote-box"><div id="footnote-close"></div></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 54: Line 54:
             $.ajax({
             $.ajax({
                   url: "https://2012.igem.org/wiki/index.php?title=Team:University_College_London/Bibliography/"+title+"&action=raw",
                   url: "https://2012.igem.org/wiki/index.php?title=Team:University_College_London/Bibliography/"+title+"&action=raw",
-
                   success: function(data){footnotebox.text(data); footnotebox.show();},
+
                   success: function(data){$('#footnote-box-content').text(data); footnotebox.show();},
                   });
                   });
       });
       });
$('#footnote-close').click(function(){footenotebox.hide();});
$('#footnote-close').click(function(){footenotebox.hide();});
});
});

Revision as of 18:06, 8 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').text(data); footnotebox.show();},
                 });
      });

$('#footnote-close').click(function(){footenotebox.hide();}); });