https://bugzilla.wikimedia.org/show_bug.cgi?id=50870
--- Comment #3 from Rainer Rillke @commons.wikimedia <[email protected]> --- >Argh, I forgot that position:fixed is always relative to the entire document, >>not to any positioned ancestor. This is only true if you set top,left,right or bottom, AFAIK. Look at [[:commons:Special:Permalink/99667607]] (the grey DIV 2 inner is fixed) See also http://stackoverflow.com/questions/8712047/positionfixed-when-left-top-right-bottom-arent-specified-desired-results-in If one still wants to use something fancier (and one will have to for safari, unfortunately), one may use jQuery: offset ( http://api.jquery.com/offset/ ) -- "Get the current coordinates of the first element in the set of matched elements, relative to the document." This way one can get the position of mw.util.$content and add 1em. Here is an example implementation (one has to execute the positioning code every time the message is shown or one has to catch window.resize events). var $content = mw.util.$content, $container = $('<div>').appendTo($content) $n = $('<div>').text('Message here').css({ 'float': 'right', // Set this in CSS so Janus can flip! 'margin': '1em' }).appendTo($container), o = $content.offset(); $container.css({ position: 'fixed', width: $content.width() }).offset(o); Feel free to improve (padding of mw.util.$content is not respected) and note that styles are also touched in skin files like skins/vector/screen.css ( https://git.wikimedia.org/blob/mediawiki%2Fcore.git/9cbd77868a92022170348504fb5444e4e1f302fa/skins%2Fvector%2Fscreen.css#L807 ) -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ Wikibugs-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
