问题描述
我使用codemirror编写自己的语言,当我停在函数名上并悬停在函数名上或按( + )时要执行的操作显示工具提示显示此函数的类型和其他数据,代码在jsfiddle.net上运行,但不在jsbin.com上运行
I make my own language using codemirror, what I want to do when I stop on name of function and hover on it or press on (+) to show tooltip display the type and other data for this function, the code run on jsfiddle.net but not run on jsbin.com
var cm = CodeMirror(document.getElementById("editor"), {
value: "function myScript() {\n return 100;\n}",
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',
container: 'body',
delay: { "show": 500, "hide": 100 },
animation: false
});
});
$('#remove').click(function() {
if (textMarker) {
textMarker.clear();
}
});
工作代码的链接:
我的尝试但不起作用:
My try but not work: my try
推荐答案
尝试在外部资源下从jsfiddle添加到jsbin。
Try adding libraries under "external resources" from jsfiddle to jsbin.
编辑:
是的,您添加了库。我让JQuery成为第一个脚本
的方法是可行的,因为您无法在JQuery之前加载引导程序。然后将 http
更改为 https
。
Yes you're right you added the libraries. I made it work putting JQuery as the first script
since you can't load bootstrap before JQuery. Then change the http
to https
.
这篇关于为什么jsfiddle.net上的代码在jsbin.com中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!