拖放在线工作但不在本地工作? [英] Drag and Drop working in online but not locally?

查看:77
本文介绍了拖放在线工作但不在本地工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请看这个小提琴: http://jsfiddle.net/hvncN/
小提琴实现了一个简单的拖放列表,并且工作正常。

Kindly see this fiddle: http://jsfiddle.net/hvncN/ This fiddle implements a simple Drag and Drop list and is working fine.

当我使用相同的代码运行时一个 Wamp服务器本地主机,它工作正常。
但无论如何,当我尝试在我的笔记本电脑本地进行操作时(没有 wamp server ),我无法做到。

And also when I run the same code using a Wamp Server localhost, it is working fine. But anyhow, when I try to do it locally in my laptop (without wamp server), I am not able to do it.

所以,这是代码:

<HTML>
<HEAD>
</HEAD>
<BODY>



<section id="demos">
    <h1>Demos</h1>
    <style>
        #demos section {
            overflow: hidden;
        }
        .sortable {
            width: 310px;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }
        .sortable.grid {
            overflow: hidden;
        }
        .sortable li {
            list-style: none;
            border: 1px solid #CCC;
            background: #F6F6F6;
            color: #1C94C4;
            margin: 5px;
            padding: 5px;
            height: 22px;
        }
        .sortable.grid li {
            line-height: 80px;
            float: left;
            width: 80px;
            height: 80px;
            text-align: center;
        }
        .handle {
            cursor: move;
        }
        .sortable.connected {
            width: 200px;
            min-height: 100px;
            float: left;
        }
        li.disabled {
            opacity: 0.5;
        }
        li.highlight {
            background: #FEE25F;
        }
        li.sortable-placeholder {
            border: 1px dashed #CCC;
            background: none;
        }
    </style>

    <section>
        <h1>Sortable List</h1>
        <ul id="sortable1" class="sortable list">
            <li draggable="true" class style="display: list-item;">Item 1
            <li draggable="true" class style="display: list-item;">Item 2
            <li draggable="true">Item 3
            <li draggable="true">Item 4
            <li draggable="true">Item 5
            <li draggable="true">Item 6
        </ul>
    </section>
</section>
<script src="/html5sortable/jquery-1.7.1.min.js"></script>
    <script src="/html5sortable/jquery.sortable.js"></script>
    <script>
        $(function() {
            $('#sortable1, #sortable2').sortable();
            $('#sortable3').sortable({
                items: ':not(.disabled)'
            });
            $('#sortable-with-handles').sortable({
                handle: '.handle'
            });
            $('#sortable4, #sortable5').sortable({
                connectWith: '.connected'
            });
        });
    </script>
</BODY>
</HTML>

这里是控制台日志中的错误:

And here is the error in the console log:

Failed to load resource file:///C:/html5sortable/jquery-1.7.1.min.js
Failed to load resource file:///C:/html5sortable/jquery.sortable.js
Uncaught ReferenceError: $ is not defined 

为什么是代码在 Fiddle Wamp Server 上正常工作,但不能在 file:/// C:/ wamp / www / test中单独打开。 html

Why is the code working properly on Fiddle and Wamp Server but not when opened Seperately as file:///C:/wamp/www/test.html

我希望它能够完全脱机工作,无需 Wamp Server ,因为我稍后会去将所有这些文件放到一个应该离线工作的混合Android应用程序中。我这样做是为了让它脱机工作?

I want it to be able to work completely offline, without Wamp Server because I am later going to put all these files into one Hybrid Android App which is supposed to be working offline. What so I do to have it work offline?

推荐答案

您定义的相对地址中还有一个/ 。删除它。

There is an additional "/" in the relative address that you have defined. Remove it.

这篇关于拖放在线工作但不在本地工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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