ASP.net Jquery找不到to()函数

ASP.net Jquery找不到to()函数,jquery,asp.net,asp.net-mvc-3,jquery-ui,jquery-plugins,Jquery,Asp.net,Asp.net Mvc 3,Jquery Ui,Jquery Plugins,我在这个问题上有点纠结,所以我想我会问其他更聪明的人:)我有一个.NET网站,我正在尝试使用Jquery插件。我已经在母版页中包含了Jquery主库和prettypto.js文件。我在其他Jquery插件中也遇到了类似的问题,我在库中找不到函数,避免这些问题的最佳方法是什么?我应该在母版页中保留所有Jquery文件,对吗?还有CSS链接?我已经在我的页面上发布了代码,请举例说明如何获取prettypto()函数。提前谢谢 <%@ Page Title="" Language="C#"

我在这个问题上有点纠结,所以我想我会问其他更聪明的人:)我有一个.NET网站,我正在尝试使用Jquery插件。我已经在母版页中包含了Jquery主库和prettypto.js文件。我在其他Jquery插件中也遇到了类似的问题,我在库中找不到函数,避免这些问题的最佳方法是什么?我应该在母版页中保留所有Jquery文件,对吗?还有CSS链接?我已经在我的页面上发布了代码,请举例说明如何获取prettypto()函数。提前谢谢

  <%@ Page Title="" Language="C#" MasterPageFile="~/Project.Master"    
  AutoEventWireup="true" CodeBehind="Portfolio.aspx.cs" Inherits="Project.Portfolio" %>
  <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

 <script type="text/javascript" charset="utf-8">
    $(document).ready(function () {
     debugger;
       //This throws error Object doesn't support property or method 'prettyPhoto'
       $("ul.gallery").prettyPhoto();
     });
</script>
  <link rel="stylesheet" href="../Stylesheets/prettyPhoto.css" type="text/css"     
  media="screen" title="prettyPhoto main stylesheet" charset="utf-8" />
  <style type="text/css" media="screen">

  ul li { display: inline; }

  </style>

  </asp:Content>
 <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

 <div id="main">
 <h2>Gallery</h2>
        <ul id="picGallery" class="gallery">
            <li><a href="../images/Portfolio/fullscreen/2krew.jpg"    
 rel="prettyPhoto[gallery1]" title="You can add caption to pictures. You can add    
 caption to pictures. You can add caption to pictures."><img src="../images/thumbnails
 /2Krewtn.jpg" width="200" height="200" alt="Red round shape" /></a></li>
            <li><a href="../images/Portfolio/fullscreen/anaura" 
 rel="prettyPhoto[gallery1]" title="You can add caption to pictures. You can add 
 caption to pictures. You can add caption to pictures."><img src="../images/thumbnails
 /anauratn.jpg" width="200" height="200" alt="Red round shape" /></a></li>
            <li><a href="../images/Portfolio/fullscreen/closed.jpg" 
 rel="prettyPhoto[gallery1]" title="You can add caption to pictures. You can add 
 caption to pictures. You can add caption to pictures."><img src="../images/thumbnails
 /Closedtn.jpg" width="200" height="200" alt="Red round shape" /></a></li>

        </ul>

 </div>

 </asp:Content>



  • 我不确定这是否是正确的方法,但要解决这个问题,jquery和母版页使用标准javascript代码启动jquery插件,而不是jquery文档。就绪:

    在我的页面底部,我添加了以下代码

    <script type="text/javascript">
        StartJqeryPlugin();
    
        function StartJqeryPlugin() {
    
            window.setTimeout(function () {
            $("ul.gallery").prettyPhoto();
            });
            }, 250);
        }
    
    
    StartJqeryPlugin();
    函数StartJqeryPlugin(){
    setTimeout(函数(){
    $(“ul画廊”).prettypto();
    });
    }, 250);
    }
    
    首先,我想看看是否有任何异常会阻止脚本正常运行(以及脚本文件是否已加载)