我有一个下拉菜单,当您在对话框内的网格中单击一个图标(实际上是一个链接的小黑色过滤器)时打开下拉菜单。如果我从target.position()获得坐标,它就完全在Chrome中定位。如何将css下拉菜单放置在IE和Chrome/Firefox的相同位置
这里是它使用target.position()看起来像在Chrome浏览器截图:
scope.showFilterMenu = function ($event, id) {
var modal = $('div[kendo-window]');
var target = $($event.currentTarget);
var offset = target.position(); // THIS WORKS FOR CHROME BUT NOT IE
var offset = target.offset(); // THIS WORKS FOR IE BUT NOT CHROME
var top = offset.top;
var left = offset.left + 25; // 25 is extra buffer
modal.append(filterMenu);
var filterMenu = $('ul[sgid=' + id + ']'); // the dropdown menu is a ul list
filterMenu.css({
'width': 50 + 'px',
'top': dd_top + 'px',
'position': 'fixed', // must be fixed so that it follows the window contract and expand
'left': left // align LHS with filter icon
});
}
但使用target.position()在IE中把它扔了完全关闭,我必须使用target.offset()。有谁知道我可以如何为两个浏览器找到解决方案?
你在说哪个IE版本? – 2014-12-04 12:51:03
我正在使用IE 11 – Tone 2014-12-04 12:52:11