javascript - jquery jquery.RotateImageMenu 未捕获语法错误 : Unexpected end of input

标签 javascript jquery ajax wordpress

我有 jquery 到服务器 [http://melodia.esy.es/wp-includes/js/jquery/jquery.js]

脚本基于1.5.2/jquery.min.js 编辑脚本后显示一条消息

未捕获的语法错误:输入意外结束 对于RotateImageMenu.init

我想将此脚本与 js.query 版本 1.12.4 集成 我能做什么请帮忙

jQuery(function ($) {
var $listItems         = $('#rm_container > ul > li'),
totalItems      = $listItems.length,

//the controls
$rm_next       = $('#rm_next'),
$rm_prev       = $('#rm_prev'),
$rm_play       = $('#rm_play'),
$rm_pause      = $('#rm_pause'),

//the masks and corners of the slider
$rm_mask_left  = $('#rm_mask_left'),
$rm_mask_right = $('#rm_mask_right'),
$rm_corner_left    = $('#rm_corner_left'),
$rm_corner_right= $('#rm_corner_right'),

RotateImageMenu = (function() {
        //difference of animation time between the items
    var timeDiff            = 300,
        //time between each image animation (slideshow)
        slideshowTime       = 3000,
        slideshowInterval,  
        //checks if the images are rotating
        isRotating          = false,
        //how many images completed each slideshow iteration
        completed           = 0,
        /*
        all our images have 310 of width and 465 of height.
        this could / should be dynamically calculated 
        if we would have different image sizes.

        we will set the rotation origin at 
        x = width/2 and y = height*2
        */
        origin              = ['155px', '930px'],
        init                = function() {
            configure();
            initEventsHandler();
        },
        //initialize some events
        initEventsHandler   = function() {
            /*
            next and previous arrows:
            we will stop the slideshow if active,
            and rotate each items images.
            1   rotate right
            -1  rotate left
            */
            $rm_next.bind('click', function(e) {
                stopSlideshow();
                rotateImages(1);
                return false;
            });
            $rm_prev.bind('click', function(e) {
                stopSlideshow();
                rotateImages(-1);
                return false;
            });
            /*
            start and stop the slideshow
            */
            $rm_play.bind('click', function(e) {
                startSlideshow();
                return false;
            });
            $rm_pause.bind('click', function(e) {
                stopSlideshow();
                return false;
            });
            /*
            adds events to the mouse and left / right keys
            */
            $(document).bind('mousewheel', function(e, delta) {
                if(delta > 0) {
                    stopSlideshow();
                    rotateImages(0);
                }   
                else {
                    stopSlideshow();
                    rotateImages(1);
                }   
                return false;
            }).keydown(function(e){
                switch(e.which){
                    case 37:
                        stopSlideshow();
                        rotateImages(0);
                        break;
                    case 39:
                        stopSlideshow();
                        rotateImages(1);
                        break;
                }
            });
        },
        /*
        rotates each items images.
        we set a delay between each item animation
        */
        rotateImages        = function(dir) {
            //if the animation is in progress return
            if(isRotating) return false;

            isRotating = true;

            $listItems.each(function(i) {
                var $item              = $(this),
                    /*
                    the delay calculation.
                    if rotation is to the right, 
                    then the first item to rotate is the first one,
                    otherwise the last one
                    */
                    interval            = (dir === 1) ? i * timeDiff : (totalItems - 1 - i) * timeDiff;

                setTimeout(function() {
                        //the images associated to this item
                    var $otherImages       = $('#' + $item.data('images')).children('img'),
                        totalOtherImages    = $otherImages.length;

                        //the current one
                        $img               = $item.children('img:last'),
                        //keep track of each items current image
                        current             = $item.data('current');
                        //out of bounds 
                        if(current > totalOtherImages - 1)
                            current = 0;
                        else if(current < 0)
                            current = totalOtherImages - 1;

                        //the next image to show and its initial rotation (depends on dir)
                        var otherRotation   = (dir === 1) ? '-30deg' : '30deg',
                            $other         = $otherImages.eq(current).clone();




            $listItems.each(function(i) {
                //the initial current is 1 
                //since we already showing the first image
                var $item = $(this).data('current', 1);

            });
        },
        //rotates the masks and corners
        rotateMaskCorners   = function() {
            $rm_mask_left.transform({rotate: '-3deg'});
            $rm_mask_right.transform({rotate: '3deg'});
            $rm_corner_left.transform({rotate: '45deg'});
            $rm_corner_right.transform({rotate: '-45deg'});
        },
        //hides the masks and corners
        hideMaskCorners     = function() {
            $rm_mask_left.hide();
            $rm_mask_right.hide();
            $rm_corner_left.hide();
            $rm_corner_right.hide();
        },
        startSlideshow      = function() {
            clearInterval(slideshowInterval);
            rotateImages(1);
            slideshowInterval   = setInterval(function() {
                rotateImages(1);
            }, slideshowTime);
            //show the pause button and hide the play button
            $rm_play.hide();
            $rm_pause.show();
        },
        stopSlideshow       = function() {
            clearInterval(slideshowInterval);
            //show the play button and hide the pause button
            $rm_pause.hide();
            $rm_play.show();


    return {init : init};
})();

RotateImageMenu.init(); });

最佳答案

旋转图像Menu.init(); });

它位于代码末尾,但不适合此标记代码

关于javascript - jquery jquery.RotateImageMenu 未捕获语法错误 : Unexpected end of input,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40442877/

相关文章:

c# - Stop OnClientClick ="aspnetForm.target =' _blank';"从其他控件点击中触发?

jquery - 有没有办法判断网络应用程序是否是从主屏幕图标启动的? iOS/安卓?

javascript - Jquery Ajax 不适用于 Codeigniter

javascript - 通过 POST 将 JSON 从 Flask 返回到 AJAX

ajax - `success: function(msg)` 在我的 jQuery Ajax 调用中意味着什么?

javascript - 构造函数定义中的 "return this": what is its role?

javascript - 访问元素而不引用它

javascript - 根据另一个对象的值在对象中创建新属性

jquery - 使用 jQuery 以可变宽度居中对象

javascript - SoundCloud Api 重定向混淆和 Audio Api Streams