summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/website.editor.js
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2014-01-20 15:46:10 +0100
committerXavier Morel <xmo@openerp.com>2014-01-20 15:46:10 +0100
commit620652c4200cb2906fcd2ae259f8af0bde282551 (patch)
tree048a9227ec81852e705dcdf6c9468f1d70a34a52 /addons/website/static/src/js/website.editor.js
parent3ad6be4466f1a3cff7bd65f5080180b343a97388 (diff)
[FIX] excessive horizontal and vertical offsetting of edition button on images in webkit browsers
Manually adding margins to offsets was necessary due to http://bugs.jquery.com/ticket/5445#comment:6 and the original code using $.fn.position(). When edition buttons were moved to being children of the body (rather than siblings of the image), $.fn.position() was replaced by $.fn.offset() (to get the position of the image/link relative to the body/page toplevel), the adjustment (addition of marginLeft/marginTop) was left in, even though #5445 does not apply to $.fn.offset(). bzr revid: xmo@openerp.com-20140120144610-nu8q2naemzzhekv2
Diffstat (limited to 'addons/website/static/src/js/website.editor.js')
-rw-r--r--addons/website/static/src/js/website.editor.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js
index 67e7277d0c5..e687dbb6a31 100644
--- a/addons/website/static/src/js/website.editor.js
+++ b/addons/website/static/src/js/website.editor.js
@@ -638,16 +638,14 @@
var $selected = $(this);
var position = $selected.offset();
if ($selected.is('img')) {
- var image_top = position.top + parseInt($selected.css('marginTop'), 10);
- var image_left = position.left + parseInt($selected.css('marginLeft'), 10);
$link_button.hide();
// center button on image
$image_button.show().offset({
top: $selected.outerHeight() / 2
- + image_top
+ + position.top
- $image_button.outerHeight() / 2,
left: $selected.outerWidth() / 2
- + image_left
+ + position.left
- $image_button.outerWidth() / 2,
});
} else {