javascript 运行时错误对象不支持属性或方法“tabs”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23439329/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 00:52:51  来源:igfitidea点击:

javascript runtime error object doesn't support property or method 'tabs'

javascriptjquery

提问by VJain

Whenever i load my page this error got hit. My code is:

每当我加载我的页面时,就会遇到此错误。我的代码是:

<head runat="server">
   <title>Jai Jinendera</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
<link rel="stylesheet" href="css/prettyPhoto.css" type="text/css"/>
<link rel="stylesheet" href="css/flexslider.css" type="text/css"/>
<link rel="stylesheet" href="css/style.css" type="text/css"/>
<!--[if lt IE 9]>
<script src="js/html5.js"></script>
<script src="js/selectivizr-min.js"></script>
<link rel="stylesheet" href="css/ie.css" type="text/css">
<![endif]-->
<script src="js/jquery.min.js"></script>
<script src="js/jquery.easing.1.3.js"></script>
<script src="js/jquery-ui-1.8.16.custom.min.js"></script>
<script src="js/all-in-one-min.js"></script>
<script src="js/setup.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js" type="text/javascript"></script>
    <script src="jquery.carouFredSel.js" type="text/javascript">
    $(window).load(function () {
        $('.flexslider').flexslider();
    });

    $(function () {
        $('#work').carouFredSel({
            width: '100%',
            scroll: 1,
            auto: false,
            pagination: false,
            prev: '.prev_item',
            next: '.next_item'
        });

        $("#work").touchwipe({
            wipeLeft: function () { $('.next_item').trigger('click'); },
            wipeRight: function () { $('.prev_item').trigger('click'); }
        });
    });

    $(window).load(function(){
        $('#demo-side-bar').removeAttr('style');
    });
</script>
<style type="text/css">
.demobar {
    display:none;
}
#demo-side-bar {
    top:53px!important;
    left:90%!important;
    display:block!important;
}
</style>
</head>

It says error in client/js/setup.js-line 10 column 5

它说 client/js/setup.js-line 10 第 5 列中的错误

and 10th line of setup.js is

setup.js 的第 10 行是

$('.tabs').tabs({ fx: { opacity: 'toggle', duration: 'fast'} });

$('.tabs').tabs({ fx: { opacity: 'toggle', duration: 'fast'} });

回答by nnnnnn

I see two problems in your <script>declarations:

我在您的<script>声明中看到两个问题:

  1. You have included jquery.min.jstwice, once from a location on your server and once from Google's CDN. Remove the latter. (Or remove the former and move the latter up to replace it.)

  2. A <script>element should either reference an external script or contain content of its own, but not both.

  1. 您已包含jquery.min.js两次,一次来自您服务器上的某个位置,一次来自 Google 的 CDN。删除后者。(或删除前者并将后者向上移动以替换它。)

  2. <script>元要么引用外部脚本或包含它自己的内容,但不能同时使用。

You need to move the code out of your jquery.carouFredSel.jsscript element:

您需要将代码移出jquery.carouFredSel.js脚本元素:

<script src="jquery.carouFredSel.js" type="text/javascript"></script>

...and then include that code in a new script element:

...然后将该代码包含在新的脚本元素中:

<script>
   $(window).load(function () {
   ...
</script>

P.S. I don't know what you have in all-in-one-min.js, but it clearly isn'tactually allin one or you wouldn't need the other scripts.

PS 我不知道你有什么all-in-one-min.js,但显然实际上并不是全部,否则你不需要其他脚本。