获得“Galleria未定义”例外

时间:2012-03-06 13:50:11

标签: javascript jquery asp.net asp.net-mvc google-chrome

之前我没有使用过这个插件。我现在得到的是:

包含的脚本

<script src="@Url.Content("~/Content/Scripts/jquery-1.7.1.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Content/Scripts/themes/classic/galleria.classic.min.js")" type="text/javascript"></script>

我在galleria标记内引用了head主题。我使用JQuery检查了GalleriaChrome web developer tools脚本的可见性(并简单地调用$("body").text("jQuery works");以确保自己Jquery正常工作)。

<script type="text/javascript">
    // $("body").text("jQuery works");
    $(document).ready(function () {
            $("#gallery").galleria({
                width: 750,
                height: 300,
                clicknext: true
            });
        } // function() {
    );  // $(document).ready(
</script>

CSHTML

<fieldset>
    @* other things*@
    @if(Model.AttachedInformation.Count > 0)
    {
        <div id="gallery">
            @foreach(var path in Model.AttachedInformation)
            {
                <img src="@path" alt="" width="50" height="50" />
            }
        </div>
    }
</fieldset>

Two moment are unclear for now :我可以保留div,然后设置样式以便gelleria内的fieldset进行识别; Chrome给我的信息是Galleria is not defined

需要建议! 谢谢!

编辑

enter image description here

1 个答案:

答案 0 :(得分:2)

您只参考了Galleria主题。您还需要参考(并下载,如果您还没有)Galleria核心。 http://galleria.io/download/

确保在主题脚本之前引用Galleria。