您好我正在使用带有codemirror的工具提示,我想要的是使工具提示的边框不在编辑器的边框之外...请参阅此链接以显示工具提示的边框如何超出编辑器的边框jsbin
这是代码: 的CSS:
.tooltip{background:red;z-index:1000;}
脚本:
var cm = CodeMirror(document.getElementById("editor"), {
value: "function myScript() {\n return 100;\n}",
mode: "javascript",
indentUnit: 4,
lineNumbers: true,
});
var textMarker;
$('#add').click(function() {
textMarker = cm.markText({
line: 1,
ch: 4
}, {
line: 1,
ch: 10
}, {
className: 'marked-text'
});
$('.marked-text').tooltip({
title: 'This is a return statement sfdl glrflg rgmlf',
container: 'body',
delay: { "show": 500, "hide": 100 },
animation: false
});
});
$('#remove').click(function() {
if (textMarker) {
textMarker.clear();
}
});
我如何解决这个问题?
注意:我想要工具提示的标题,所以panding 0无法解决问题