【问题标题】:Getting `Galleria is not defined` exception获取 `Galleria is not defined` 异常
【发布时间】:2012-03-06 13:50:10
【问题描述】:

我以前没用过那个插件。我现在得到的是:

包含的脚本

<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>

我在 head 标记内引用 galleria 主题。我已经使用Chrome web developer tools 检查了JQueryGalleria 脚本的可见性(并且只需调用$("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 保留在fieldset 中,然后将其样式化以供gelleria 识别吗? Chrome 给我的消息是 Galleria is not defined

需要建议! 谢谢!

编辑

【问题讨论】:

  • 这表明 Galleria javascript 文件没有被包含在内。你确定这个网址是正确的吗?在元素资源管理器中打开head并点击url进行确认。

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


【解决方案1】:

您只引用了 Galleria 主题。您还需要参考(如果尚未下载,请下载)Galleria 核心。 http://galleria.io/download/

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-03-23
    • 2017-10-26
    • 1970-01-01
    • 2022-01-02
    • 1970-01-01
    • 1970-01-01
    • 2015-01-29
    • 1970-01-01
    相关资源
    最近更新 更多