[dw-free] Parts of the contextual hover menu may spill over the edge of the screen
[commit: http://hg.dwscoalition.org/dw-free/rev/d37771f3da27]
http://bugs.dwscoalition.org/show_bug.cgi?id=3742
Recalculate the hover menu's position every time its displayed or redrawn.
Patch by
fu.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3742
Recalculate the hover menu's position every time its displayed or redrawn.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- htdocs/js/jquery.ajaxtip.js
- htdocs/js/jquery.contextualhover.js
-------------------------------------------------------------------------------- diff -r 534cacaf25cf -r d37771f3da27 htdocs/js/jquery.ajaxtip.js --- a/htdocs/js/jquery.ajaxtip.js Fri Jun 17 15:47:05 2011 +0800 +++ b/htdocs/js/jquery.ajaxtip.js Fri Jun 17 15:52:46 2011 +0800 @@ -44,7 +44,10 @@ } tip.css({position: "absolute", top: "", left: ""}) - .position({ my: "left top", at: "left bottom", of: self.element, collision: "fit"}) + self._reposition( tip ); + }, + onShow: function(e) { + self._reposition( this.getTip() ); } }, self.options.tooltip)); }, @@ -52,6 +55,9 @@ if(this.options.content) this.element.data("tooltip").show() }, + _reposition: function( tip ) { + tip.position({ my: "left top", at: "left bottom", of: this.element, collision: "fit"}) + }, _endpointurl : function( action ) { // if we are on a journal subdomain then our url will be // /journalname/__rpc_action instead of /__rpc_action @@ -91,7 +97,10 @@ dataType: "json", complete: function() { var tip = self.element.data("tooltip"); - if ( tip ) tip.inprogress = false; + if ( tip ) { + tip.inprogress = false; + self._reposition( tip.getTip() ); + } }, success: opts.success, error: opts.error ? opts.error : function( jqxhr, status, error ) { diff -r 534cacaf25cf -r d37771f3da27 htdocs/js/jquery.contextualhover.js --- a/htdocs/js/jquery.contextualhover.js Fri Jun 17 15:47:05 2011 +0800 +++ b/htdocs/js/jquery.contextualhover.js Fri Jun 17 15:52:46 2011 +0800 @@ -122,8 +122,6 @@ this.element.ajaxtip("cancel"); } - this.element.ajaxtip("show") - var $inner = $("<div class='Inner'></div>"); var $content = $("<div class='Content'></div>"); @@ -319,10 +317,11 @@ $content.append($("<div class='ljclear'> </div>")); + this.element.ajaxtip("show") this.element .ajaxtip("widget") .removeClass("ajaxresult ajaxtooltip").addClass("ContextualPopup") - .empty().append($inner) + .empty().append($inner); }, _changeRelation: function(info, action, link, e) { --------------------------------------------------------------------------------