未捕获的TypeError:对象[object Object]没有方法'switchClass'

时间:2013-11-24 15:31:21

标签: javascript

我正在尝试为我的网站制作一个复活节彩蛋。我以前在不同的项目中使用过此代码,唯一的区别是正在切换的类名。输入secret1作为输入时,我在控制台中获得Uncaught TypeError: Object [object Object] has no method 'switchClass'。这是我的剧本:

var secret1 = "70767380"; //flip
var secret2 = "857870767380"; //unflip
var input = "";
var timer;
var mode = false;

$(document).keyup(function(e) {
    input += e.which;    

    clearTimeout(timer);
    timer = setTimeout(function() { input = ""; }, 1000);

    check_input();
});

function check_input() {
    if(input === secret1) {
        $( ".desktop_wrapper" ).switchClass( "desktop_wrapper", "desktop_wrapper_flip", 1000 );        
    }
}

$(document).ready(function() {
    setInterval(function() { $('#info').html('Keystroke: ' + input); }, 100);
});

我的CSS:

.desktop_wrapper
    {
        position: relative;
        background-color: #ffffff;
        /*Høyde kun for å illustrere scrolling*/
        height: 2000px;
        width: 80%;
        max-width: 1024px;

        margin-right: auto;
        margin-left: auto;

        box-shadow: 0px 0px 150px 30px #b5b5b5, 0px 0px 10px 2px #000000;
    }

    .desktop_wrapper_flip
    {
        -moz-transform: scaleX(-1);
        -o-transform: scaleX(-1);
        -webkit-transform: scaleX(-1);
        transform: scaleX(-1);
        filter: FlipH;
        -ms-filter: “FlipH”;
    }

0 个答案:

没有答案