【问题标题】:jQuery doesn't pass in functionjQuery没有传入函数
【发布时间】:2013-03-18 02:01:18
【问题描述】:

我正在尝试实现一个 jQuery 函数来在网站上上传文件。该脚本使用“plupload”。

不幸的是,后台运行了另一个 jQuery 函数。

<script type="text/javascript">
    jQuery(function ($) {
        $.supersized({
            // Functionality
            slide_interval: ss_interval, // Length between transitions
            transition: 1, // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left or ss_transitionType
            transition_speed: ss_transitionSpeed, // Speed of transition
            // Slides   
            slides: [ // Slideshow Images
            {
                image: 'images/gallery/1.jpg',
                title: 'Upload and share your music with other...',
                title2: 'Music'
            }, {
                image: 'images/gallery/2.jpg',
                title: 'Share your work online and access your documents from anywhere. ',
                title2: 'Documents'
            }, {
                image: 'images/gallery/3.jpg',
                title: 'Show off your favorite photos and videos to the world.',
                title2: 'Photography'
            }, {
                image: 'images/gallery/4.jpg',
                title: 'Let the world watch your videos, or share them privately.',
                title2: 'Video'
            }, {
                image: 'images/gallery/8.jpg',
                title: 'Free file storage service. Share files with your friends.',
                title2: 'Upload and Share'
            }]
        });
        $("#uploader").plupload({
            // General settings
            runtimes: 'flash,html5,browserplus,silverlight,gears,html4',
            url: 'upload.php',
            max_file_size: '1000mb',
            max_file_count: 20, // user can add no more then 20 files at a time
            chunk_size: '1mb',
            unique_names: true,
            multiple_queues: true,
            // Resize images on clientside if we can
            resize: {
                width: 320,
                height: 240,
                quality: 90
            },
            // Rename files by clicking on their titles
            rename: true,
            // Sort files
            sortable: true,
            // Specify what files to browse for
            filters: [{
                title: "Image files",
                extensions: "jpg,gif,png"
            }, {
                title: "Zip files",
                extensions: "zip,avi"
            }],
            // Flash settings
            flash_swf_url: 'js/upload/plupload.flash.swf',
            // Silverlight settings
            silverlight_xap_url: 'js/upload/plupload.silverlight.xap'
        });
        // Client side form validation
        $('form').submit(function (e) {
            var uploader = $('#uploader').plupload('getUploader');
            // Files in queue upload them first
            if (uploader.files.length > 0) {
                // When all files are uploaded submit form
                uploader.bind('StateChanged', function () {
                    if (uploader.files.length === (uploader.total.uploaded + uploader.total.failed)) {
                        $('form')[0].submit();
                    }
                });
                uploader.start();
            } else alert('You must at least upload one file.');
            return false;
        });
    });
</script>

问题是:没有任何效果,页面什么也没有返回。但是,如果我删除这部分(见下文),上传的功能会起作用:

$.supersized({
    // ...
});

请问有人可以帮我解决这个问题吗?我在控制台中收到以下错误:

Uncaught TypeError: Object [object Object] has no method 'pajinate' jScript.js:134

Uncaught TypeError: Object function (a,b){return new d.fn.init(a,b,g)} has no method 'supersized' jquery.min.js:16

【问题讨论】:

  • 您是否收到任何错误...。检查您的控制台...。如果是,请在此处发布...这将有助于找出问题
  • 什么是$.supersized
  • 这是幻灯片。在此处查看更多信息:buildinternet.com/project/supersized/slideshow/3.2/demo.html
  • 嗯,错误意味着提供此方法的文件未正确加载或者不是函数的名称。
  • 您是否包含使超大幻灯片插件工作的文件?如果文件丢失,则会触发此类错误。

标签: php javascript jquery html plupload


【解决方案1】:

查看插件 ..有两个与此插件相关的主要文件 js/supersized.3.2.6.min.jstheme/supersized.shutter.min.js... 看起来您缺少其中一个文件。在 jquery.js 之后将其加载到 &lt;head&gt; 中,它应该可以工作..

【讨论】:

  • 这两个脚本都加载在标题中,这一点毫无疑问。我认为问题在于无法同时加载两个脚本或类似的东西..
  • can't be loaded 我认为如果您一个接一个地调用它,那不应该发生...查看源并单击链接..应该向您显示文件的内容..只是为了确保..你给的路径是正确的
  • 我有支票。没有问题。证据是,如果我删除超大的部分,上传插件就可以工作。
  • the proof is that if I delete the supersized part, the upload plugin works 这就是为什么我怀疑没有正确加载文件...看到您的错误has no method 'supersized' ....这意味着它找不到称为超大的方法... .so如果你正确加载它怎么会这样 .. :) :)
【解决方案2】:

我发现了我的问题所在,谢谢大家!

问题是我有 2 个版本的 jquery loader。我已经删除了旧版本,它可以工作!

谢谢大家

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-09
    • 1970-01-01
    • 2013-06-19
    • 1970-01-01
    • 1970-01-01
    • 2013-12-31
    相关资源
    最近更新 更多