为什么jsfiddle.net上的代码在jsbin.com中不起作用? [英] Why is the code on jsfiddle.net not working in jsbin.com?

查看:65
本文介绍了为什么jsfiddle.net上的代码在jsbin.com中不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用codemirror编写自己的语言,当我停在函数名上并悬停在函数名上或按( Ctrl + I )时要执行的操作显示工具提示显示此函数的类型和其他数据,代码在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 (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();
    }
});

工作代码的链接:此处的代码有效

我的尝试但不起作用:我的尝试

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中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆