jQuery tooltip detect screen edge
问题 I have some basic hover/tooltip code working that needs to be modified so that a second class name is added when the tooltip hits the edge of the browser window. Can anyone lend a hand? this.tooltip = function () { $(".challenge_card").hover(function (e) { $(this).parent().append("<div id='tooltip'></div>"); $("#tooltip") .fadeIn("fast"); }, function () { $("#tooltip").remove(); }); }; 回答1: var wW = $(window).width(); var $tooltip = $('#tooltip'); if($tooltip.offset().left + $tooltip