未捕获的TypeError:Object#< Object>没有方法'movingBoxes' [英] Uncaught TypeError: Object #<Object> has no method 'movingBoxes'

查看:167
本文介绍了未捕获的TypeError:Object#< Object>没有方法'movingBoxes'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的asp.net mvc网站上使用movingBoxes插件,但它不起作用(显然)。
我在site.master中的head标签中导入了movingboxes.js,如此

Im trying to use the movingBoxes plugin with my asp.net mvc site and it is not working (obviously). I have the movingboxes.js imported in my head tag in the site.master like so

    <script src="<%: Url.Content("~/Scripts/jquery.movingboxes.js")%>" type="text/javascript"></script>

并且浏览器成功获取此脚本。现在我有一个继承自site.master的常规视图,其中包含调用movingBoxes插件的一点点jquery

and the browser successfully gets this script. Now i have a regular view that inherits from the site.master that has this little bit of jquery in it that calls the movingBoxes plugin

<script type="text/javascript">
    $(document).ready(function () {
        $($('#slider-one'));
        $('#slider-one').movingBoxes({
            startPanel: 1,      
            panelWidth: .5,     
            fixedHeight: false
        });

        $('#slider-two').movingBoxes({
            startPanel: 1,     
            panelWidth: .5,     
            fixedHeight: false
        });
    });
</script>

当我查看页面时。每个东西都运行正常(包括其他jquery东西),除了这个插件,我得到这个错误

When i view the page. Every thing works fine (including other jquery stuff) except for this plugin and i get this error

以下是错误的描述

And here is the description of the error

任何帮助将不胜感激

编辑

显然我有这个:

    <script type="text/javascript" src="../../Scripts/jquery-1.4.1.js" />
    <script src="<%: Url.Content("~/Scripts/jquery.movingboxes.js")%>" type="text/javascript"></script>

现在可以将其更改为:

    <script type="text/javascript" src="../../Scripts/jquery-1.4.1.js"></script>
    <script src="<%: Url.Content("~/Scripts/jquery.movingboxes.js")%>" type="text/javascript"></script>


推荐答案

有几件事你可以试试这个工作。

There are a few things you can try to get this working.


  1. 绝对确保您的脚本被拉入页面,一种方法是使用'来源'进行检查Chrome调试器中的标签页并搜索该文件。

  1. Be ABSOLUTELY sure your script is being pulled into the page, one way to check is by using the 'sources' tab in the Chrome Debugger and searching for the file.

确保在包含jQuery之后已包含该脚本,因为它肯定是依赖于此。

Be sure that you've included the script after you've included jQuery, as it is most certainly dependant upon that.

除此之外,我检查了API,你肯定做的一切都是正确的我所看到的。祝你好运!

Other than that, I checked out the API and you're definitely doing everything right as far as I can see. Best of luck friend!

编辑:确保关闭脚本标签。下面的答案指出了解决方案。

Ensure you close your script tag. There's an answer below that points to that being the solution.

这篇关于未捕获的TypeError:Object#&lt; Object&gt;没有方法'movingBoxes'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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