问题
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 (Ctrl+I) 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();
}
});
The link to working code: here code works
My try but not work: my try
回答1:
Try adding libraries under "external resources" from jsfiddle to jsbin.
Edit:
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
.
来源:https://stackoverflow.com/questions/42467975/why-is-the-code-on-jsfiddle-net-not-working-in-jsbin-com