jQuery(document).ready(function($) { $('.wp_syntax').bind( { mouseover: function() { var w = $(this).find('table').outerWidth(); var hw = $(document).width() - $(this).offset().left - 20; /* * Test code. */ /*var left, top; left = $(this).offset().left; top = $(this).offset().top; $(this) .appendTo('body') .css({ 'position': 'absolute', 'left': left + 'px', 'top': top + 'px' }); */ if(w > $(this).outerWidth()) { // $(this).css({'position':'relative', 'z-index':'9999', 'box-shadow':'5px 5px 5px #888', 'width':(w > hw ? hw : w)+'px'}); $(this).css({'position':'relative', 'z-index':'9999', 'width':(w > hw ? hw : w)+'px'}); } }, mouseout: function() { // $(this).removeAttr('style'); $(this).css({'position':'relative', 'z-index':'', 'width':'auto'}); }, dblclick: function() { //Create text area on top of code on double click //This can make copying of the code easier var jthis = $(this); if (!jthis.data('hasTextArea')) { var code = jthis.find(".theCode").html(); var ta = $('