【问题标题】:Issue when using Galleria theme with ASP.NET MVC3将 Galleria 主题与 ASP.NET MVC3 一起使用时出现问题
【发布时间】:2011-08-01 17:02:32
【问题描述】:
我正在尝试使用 Galleria 照片库。
问题:主题加载代码
Galleria.loadTheme('/galleria/themes/classic/galleria.classic.min.js'); 只有当我们在家庭控制器的默认操作(即 Home/Index)中使用它时才能正常工作
我在一个名为 Display 的视图上使用该主题。所以我在 Home 中写了一个动作来返回显示视图。
图像必须在 Galleria 主题照片查看器中显示,但它们会一个接一个地显示为图像。
如果我尝试从索引操作调用显示视图,它工作正常。但我想在索引视图中做其他事情。
任何帮助将不胜感激。
【问题讨论】:
标签:
asp.net-mvc-3
jquery-plugins
themes
galleria
【解决方案1】:
主题脚本似乎没有加载。原因可能是虚拟路径问题。
我习惯用这种方式使用 Galleria 插件:
<script src="@Url.Content("~/Scripts/JQuery.Galleria/1.2.5/galleria-1.2.5.min.js")" type="text/javascript"></script>
<script type="text/javascript">
var virtualPath = '@Url.Content("~/")';
$(document).ready(function () {
Galleria.loadTheme(virtualPath + '/Scripts/jQuery.Galleria/1.2.5/themes/twelve/galleria.twelve.min.js');
// Initialize Galleria
$('#galleria').galleria({ autoplay: false, /* true, miliseconds */
thumbnails: true, /*true, false, numbers, empty */
imageCrop: true, /*true, false, height, width */
transition: "pulse", /*fade, fadeslide, slide, flash, pulse */
trasitionSpeed: 500,
thumbFit: true
});
});
</script>
希望这会有所帮助。